Add Slack notify helper for deployment alerts
This commit is contained in:
parent
c6641200da
commit
089e305363
1 changed files with 11 additions and 0 deletions
11
lib/notify.sh
Normal file
11
lib/notify.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Send a Slack notification via webhook.
|
||||||
|
# Usage: notify "Deployment of v1.2.3 succeeded" "#deployments"
|
||||||
|
|
||||||
|
notify() {
|
||||||
|
local msg="$1"
|
||||||
|
local channel="${2:-#ops}"
|
||||||
|
curl -sf -X POST "$SLACK_WEBHOOK_URL" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"channel\": \"$channel\", \"text\": \"$msg\"}"
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue