* Add script notification (#53) * Fix SysProcAttr * Fix build constraint Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
5.6 KiB
Notifications
Amqp
You can send notifications to any amqp compatible server with the following settings:
amqphost: AMQP server host (default:localhost). requiredport: AMQP server port (default:5672). requiredusername: AMQP username. requiredusername_file: Use content of secret file as AMQP username ifusernamenot defined.password: AMQP password. requiredpassword_file: Use content of secret file as AMQP password ifpasswordnot defined.exchange: Name of the exchange the message will be sent to. (default:empty)queue: Name of the queue the message will be sent to. required
The JSON response will look like this:
{
"diun_version": "0.3.0",
"status": "new",
"provider": "file",
"image": "docker.io/crazymax/swarm-cronjob:0.2.1",
"mime_type": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:5913d4b5e8dc15430c2f47f40e43ab2ca7f2b8df5eee5db4d5c42311e08dfb79",
"created": "2019-01-24T10:26:49.152006005Z",
"platform": "linux/amd64"
}
Gotify
Notifications can be sent using a Gotify instance:
gotifyendpoint: Gotify base URL (e.g.http://gotify.foo.com). requiredtoken: Application token. requiredpriority: The priority of the message.timeout: Timeout specifies a time limit for the request to be made. (default:10).
Notifications can be sent through SMTP:
mailhost: SMTP server host (default:localhost). requiredport: SMTP server port (default:25). requiredssl: SSL defines whether an SSL connection is used. Should be false in most cases since the auth mechanism should use STARTTLS (default:false).insecure_skip_verify: Controls whether a client verifies the server's certificate chain and hostname (default:false).username: SMTP username.username_file: Use content of secret file as SMTP username ifusernamenot defined.password: SMTP password.password_file: Use content of secret file as SMTP password ifpasswordnot defined.from: Sender email address. requiredto: Recipient email address. required
Rocket.Chat
To be able to send notifications to your Rocket.Chat channel:
You must first create a Personal Access Token through your account settings on your RocketChat instance.
rocketchatendpoint: Rocket.Chat base URL (e.g.http://rocket.foo.com:3000). requiredchannel: Channel name with the prefix in front of it. requireduser_id: User ID. requiredtoken: Authentication token. requiredtimeout: Timeout specifies a time limit for the request to be made. (default:10).
Script
You can send script notifications with the following settings:
scriptcmd: Command or script to execute. requiredargs: List of args to pass tocmd.dir: Specifies the working directory of the command.
Following environment variables are passed to the process and will look like this:
DIUN_VERSION=3.0.0
DIUN_ENTRY_STATUS=new
DIUN_ENTRY_PROVIDER=file
DIUN_ENTRY_IMAGE=docker.io/crazymax/diun:latest
DIUN_ENTRY_MIMETYPE=application/vnd.docker.distribution.manifest.list.v2+json
DIUN_ENTRY_DIGEST=sha256:216e3ae7de4ca8b553eb11ef7abda00651e79e537e85c46108284e5e91673e01
DIUN_ENTRY_CREATED=2020-03-26 12:23:56 +0000 UTC
DIUN_ENTRY_PLATFORM=linux/adm64
Slack
You can send notifications to your Slack channel using an incoming webhook URL:
slackwebhook_url: Slack incoming webhook URL. required
Teams
You can send notifications to your Teams team-channel using an incoming webhook URL:
teamswebhook_url: Teams incoming webhook URL. required
Telegram
Notifications can be sent via Telegram using a Telegram Bot.
Follow the instructions to set up a bot and get it's token.
Message the GetID bot to find your chat ID. Multiple chat IDs can be provided in order to deliver notifications to multiple recipients.
telegramtoken: Telegram bot token. requiredchat_ids: List of chat IDs to send notifications to. required
Webhook
You can send webhook notifications with the following settings:
webhookendpoint: URL of the HTTP request. requiredmethod: HTTP method (default:GET). requiredheaders: Map of additional headers to be sent.timeout: Timeout specifies a time limit for the request to be made. (default:10).
The JSON response will look like this:
{
"diun_version": "0.3.0",
"status": "new",
"provider": "file",
"image": "docker.io/crazymax/swarm-cronjob:0.2.1",
"mime_type": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:5913d4b5e8dc15430c2f47f40e43ab2ca7f2b8df5eee5db4d5c42311e08dfb79",
"created": "2019-01-24T10:26:49.152006005Z",
"platform": "linux/amd64"
}





