forked from Seedstars/culture-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotify_slack.sh
More file actions
executable file
·18 lines (15 loc) · 877 Bytes
/
notify_slack.sh
File metadata and controls
executable file
·18 lines (15 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash
# You can test this by running `deploy/notify_slack.sh pass 111 my_branch http://my-build-url.com`
# If it fails with permission denied, make sure you run `chmod u+x notify_slack.sh` first.
STATUS=$1
GROUP=$2
PROJECT=$3
PIPELINE_ID=$4
BRANCH=$5
URL=$6
SLACK_URL=$7 # This should be a long URL like https://hooks.slack.com/services/AAAAA/BBBB/CCCC.
if [ "$STATUS" = "pass" ]; then
curl -X POST --data-urlencode 'payload={"username": "happyshippy", "text": "PASSING '"$GROUP"'/'"$PROJECT"'/'"$BRANCH"' (Pipeline '"$PIPELINE_ID"'). --> '"$URL"'/pipelines/'"$PIPELINE_ID"'", "icon_emoji": ":sunglasses:"}' $SLACK_URL
else
curl -X POST --data-urlencode 'payload={"username": "sadshippy", "text": "FAILING '"$GROUP"'/'"$PROJECT"'/'"$BRANCH"' (Pipeline '"$PIPELINE_ID"'). --> '"$URL"'/pipelines/'"$PIPELINE_ID"'", "icon_emoji": ":scream:"}' $SLACK_URL
fi