Search code examples
gitlabgitlab-cipipelinecontinuous-deploymentcicd

GitLab CI teams notification on specific step


I'm try to create a notification when a specific pipeline step is execute.

In particular I have a GitLab pipeline that execute the deploy of the master branch in test environment like the following

deploy:
  stage: deploy
  script:
  # script for deploy
  only:
  - master

I want to publish to teams channel only when this step is triggered.

Exist a way to do this? I already know the standard integration between GitLab and Teams but this publish a message every time the pipeline run and not only for a specific step.


Solution

  • You can create a webhook in teams and using curl send the data you need in the script section.

    script:
     - curl -H "Content-Type:application/json" -d '{"test": "test"}' $WEBHOOK_URL