3

I used the following code to notify Slack about new artifacts created by GitLab-CI, which is not very nice, and it has some limitations.

Notify slack:
  stage: notify
  tags:
    - docker
  variables:
    DATA: '{"text":"${CI_JOB_URL}/artifacts/browse","channel":"#my-channel","username":"GitLab-CI"}'
    CONTENT_TYPE: 'Content-type: application/json'
    SLACK_WEBHOOK: 'https://hooks.slack.com/services/-----/---/---------'
  script:
    - curl -X POST -H $CONTENT_TYPE --data $DATA $SLACK_WEBHOOK

Is there a nicer way to achieve this ($CI_ARTIFACTS_URL or similar)?

Federico Bellini
  • 365
  • 1
  • 7
  • 18

0 Answers0