Skip to content

Commit

Permalink
schutzbot: shorten the slack notification
Browse files Browse the repository at this point in the history
We are on a quest to reduce clutter on our Slack channels. Thus,
I decided to simplify the daily CI notifications:
  - the link to the edge pipelines got removed, it's now in bookmarks
  - several words were removed to make the message shorter
  - the link to the pipeline is now a hyperlink
  - the whole message should be a one liner
  - less text is now bold

I've also simplified the format in which we send the message. I think
that the block format used before makes redundant line-breaks.
Unfortunately, the mentions need to be done using user IDs instead
of user names. If you ever need to find them, go to the user's profile,
click on the three dots and select "Copy member ID".
  • Loading branch information
ondrejbudai committed Oct 24, 2024
1 parent d591225 commit eaf90f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions schutzbot/slack_notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ if [ -z "${SLACK_WEBHOOK_URL:-}" ]; then
fi

if [ "$3" == "ga" ]; then
MESSAGE="\"GA composes pipeline execution finished with status *$1* $2 \n QE: @atodorov, @jrusz, @tkosciel\n Link to results: $CI_PIPELINE_URL \""
MESSAGE="\"<$CI_PIPELINE_URL|GA composes pipeline>: *$1* $2, cc <@U01CUGX9L68>, <@U01Q07AHZ9C>, <@U04PYMDRV5H>\""
else
COMPOSE_ID=$(cat COMPOSE_ID)
COMPOSER_NVR=$(cat COMPOSER_NVR)
MESSAGE="\"Nightly pipeline execution on *$COMPOSE_ID* with *$COMPOSER_NVR* finished with status *$1* $2 \n QE: @atodorov, @jrusz, @tkosciel\n Link to results: $CI_PIPELINE_URL\n For edge testing status please see https://url.corp.redhat.com/edge-pipelines \""
MESSAGE="\"<$CI_PIPELINE_URL|Nightly pipeline> ($COMPOSE_ID: $COMPOSER_NVR): *$1* $2, cc <@U01CUGX9L68>, <@U01Q07AHZ9C>, <@U04PYMDRV5H>\""
fi

curl \
-X POST \
-H 'Content-type: application/json' \
--data '{"text": "test", "blocks": [ { "type": "section", "text": {"type": "mrkdwn", "text":'"$MESSAGE"'}}]}' \
--data '{"text": '"$MESSAGE"'}' \
"$SLACK_WEBHOOK_URL"

0 comments on commit eaf90f5

Please sign in to comment.