debian-forge-composer/schutzbot/slack_notification.sh
Tom Koscielniak 0dcbece2ca CI: Update slack notifications and remove Alex
Remove Alex from Slack CI notifications, add Achilleas and tag only on failures.
2025-02-25 13:35:44 +01:00

30 lines
863 B
Bash
Executable file

#!/bin/bash
set -eux
if [ -z "${SLACK_WEBHOOK_URL:-}" ]; then
echo "INFO: Variable SLACK_WEBHOOK_URL is undefined"
exit 0
fi
if [ "$3" == "ga" ]; then
if [ "$1" == "FAILED" ]; then
MESSAGE="\"<$CI_PIPELINE_URL|GA composes pipeline>: *$1* $2, cc <@U01S1KWFMFF>, <@U04PYMDRV5H>\""
else
MESSAGE="\"<$CI_PIPELINE_URL|GA composes pipeline>: *$1* $2\""
fi
else
COMPOSE_ID=$(cat COMPOSE_ID)
COMPOSER_NVR=$(cat COMPOSER_NVR)
if [ "$1" == "FAILED" ]; then
MESSAGE="\"<$CI_PIPELINE_URL|Nightly pipeline> ($COMPOSE_ID: $COMPOSER_NVR): *$1* $2, cc <@U01S1KWFMFF>, <@U04PYMDRV5H>\""
else
MESSAGE="\"<$CI_PIPELINE_URL|Nightly pipeline> ($COMPOSE_ID: $COMPOSER_NVR): *$1* $2\""
fi
fi
curl \
-X POST \
-H 'Content-type: application/json' \
--data '{"text": '"$MESSAGE"'}' \
"$SLACK_WEBHOOK_URL"