Skip to content

Instantly share code, notes, and snippets.

@aleksandr-kotlyar
Last active April 19, 2022 14:53
Show Gist options
  • Save aleksandr-kotlyar/c21d0bc92266c5edcbd9255b04b6a90d to your computer and use it in GitHub Desktop.
Save aleksandr-kotlyar/c21d0bc92266c5edcbd9255b04b6a90d to your computer and use it in GitHub Desktop.
slack text notifications
SLACK_TEXT_START: 'Pipeline <$CI_PIPELINE_URL|$CI_PIPELINE_ID> _has started_ *$CI_PIPELINE_SOURCE* job <$CI_JOB_URL|$CI_JOB_ID> on *$ENVIRONMENT* _at branch_ *<$CI_PROJECT_URL/commit/$CI_COMMIT_SHA|$CI_COMMIT_REF_NAME>*'
SLACK_TEXT_FINISH: 'Pipeline <$CI_PIPELINE_URL|$CI_PIPELINE_ID> _has finished_ *$CI_PIPELINE_SOURCE* job <$CI_JOB_URL|$CI_JOB_ID> on *$ENVIRONMENT* _at branch_ *<$CI_PROJECT_URL/commit/$CI_COMMIT_SHA|$CI_COMMIT_REF_NAME>* _and generated_ *<$ALLURE_DIR|Allure Reports>*'
#####################################
# Custom Slack POST-message report #
#####################################
slack_notification:
script:
- >
curl
--request POST
--data-urlencode
"payload={
\"channel\":\"$SLACK_CHANNEL\",
\"username\":\"$SLACK_USER\",
\"text\":\"$SLACK_TEXT_FINISH\",
\"icon_emoji\":\":gitlab:\"
}"
https://hooks.slack.com/services/$SLACK_TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment