Welcome to mirror list, hosted at ThFree Co, Russian Federation.

notify_slack.sh « scripts - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a4239e132c77f9058e1a4f5f631aa612f5f0238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
# Sends Slack notification ERROR_MSG to CHANNEL
# An env. variable CI_SLACK_WEBHOOK_URL needs to be set.

CHANNEL=$1
ERROR_MSG=$2

if [ -z "$CHANNEL" ] || [ -z "$ERROR_MSG" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ]; then
    echo "Missing argument(s) - Use: $0 channel message"
    echo "and set CI_SLACK_WEBHOOK_URL environment variable."
else
    curl -X POST --data-urlencode 'payload={"channel": "'"$CHANNEL"'", "username": "gitlab-ci", "text": "'"$ERROR_MSG"'", "icon_emoji": ":gitlab:"}' "$CI_SLACK_WEBHOOK_URL"
fi