Slack notifications for pipeline status changes only

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Problem to solve

In the Slack integration, when Notify only broken pipelines is not ticked Slack notifications for pipeline events fire for every build even when they are all successful. Enabling the aforementioned option doesn't notify when the pipeline goes green.

The description of the Pipeline trigger Event will be triggered when a pipeline status changes is misleading because:

  • use of the word status suggests notification is only trigger for status changes from failed to success or vice versa
  • actual behavior is every action associated with CI/CD pipelines triggers a notification, not just status changes
Expand for details of provided when this issue was originally submitted as a bug

Steps to reproduce

  1. Enable Slack notifications for a project with Pipeline triggers ticked and pointing to a suitable Slack channel, Notify only broken pipelines not ticked and Notify only default branch ticked (might not be needed but that's what we are using right now because we only care about master).
  2. Create a Gitlab CI pipeline
  3. Make the build fail
  4. Make the build fail again
  5. Make the build pass
  6. Make the build pass again

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Debian 8.6 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Git Version: 2.13.0 Sidekiq Version:5.0.0 Go Version: unknown

GitLab information Version: 9.3.0 Revision: acb7f25 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.example.com HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git SSH Clone URL: git@gitlab.example.com:some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 5.0.5 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab Shell ...

GitLab Shell version >= 5.0.5 ? ... OK (5.0.5) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 3/7 ... ok 3/8 ... ok 3/9 ... ok 3/10 ... ok 3/11 ... ok 3/12 ... ok 3/13 ... ok 3/14 ... ok 3/15 ... ok 3/16 ... ok 3/17 ... ok 3/18 ... ok 3/19 ... ok 3/20 ... ok 3/21 ... ok 3/22 ... ok 3/23 ... ok 3/24 ... ok 3/25 ... ok 3/26 ... ok 3/27 ... ok 3/28 ... ok 8/29 ... ok 3/30 ... ok 3/31 ... ok 3/32 ... ok 5/33 ... ok 10/34 ... ok 3/35 ... ok 3/36 ... ok 8/37 ... ok 3/41 ... ok 3/42 ... ok 3/43 ... ok 10/44 ... ok 3/45 ... ok 3/46 ... ok 10/48 ... ok 11/49 ... ok 10/50 ... ok 2/51 ... ok 2/52 ... ok 2/53 ... ok 2/54 ... ok 10/55 ... ok 15/56 ... ok 13/57 ... ok 15/58 ... ok 3/59 ... ok 3/60 ... ok 3/61 ... ok 14/62 ... ok 3/64 ... ok 16/65 ... ok 3/66 ... ok 16/67 ... ok 3/68 ... ok 10/69 ... ok 11/70 ... ok 3/72 ... ok 2/73 ... ok 18/74 ... ok 3/75 ... ok 10/76 ... ok 5/77 ... ok 16/78 ... ok 18/79 ... ok 3/80 ... ok 18/81 ... ok 19/82 ... ok 13/83 ... ok 13/84 ... ok 11/85 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 3/7 ... yes 3/8 ... yes 3/9 ... yes 3/10 ... yes 3/11 ... yes 3/12 ... yes 3/13 ... yes 3/14 ... yes 3/15 ... yes 3/16 ... yes 3/17 ... yes 3/18 ... yes 3/19 ... yes 3/20 ... yes 3/21 ... yes 3/22 ... yes 3/23 ... yes 3/24 ... yes 3/25 ... yes 3/26 ... yes 3/27 ... yes 3/28 ... yes 8/29 ... yes 3/30 ... yes 3/31 ... yes 3/32 ... yes 5/33 ... yes 10/34 ... yes 3/35 ... yes 3/36 ... yes 8/37 ... yes 3/41 ... yes 3/42 ... yes 3/43 ... yes 10/44 ... yes 3/45 ... yes 3/46 ... yes 10/48 ... yes 11/49 ... yes 10/50 ... yes 2/51 ... yes 2/52 ... yes 2/53 ... yes 2/54 ... yes 10/55 ... yes 15/56 ... yes 13/57 ... yes 15/58 ... yes 3/59 ... yes 3/60 ... yes 3/61 ... yes 14/62 ... yes 3/64 ... yes 16/65 ... yes 3/66 ... yes 16/67 ... yes 3/68 ... yes 10/69 ... yes 11/70 ... yes 3/72 ... yes 2/73 ... yes 18/74 ... yes 3/75 ... yes 10/76 ... yes 5/77 ... yes 16/78 ... yes 18/79 ... yes 3/80 ... yes 18/81 ... yes 19/82 ... yes 13/83 ... yes 13/84 ... yes 11/85 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.0) Active users: ... 15

Checking GitLab ... Finished

Intended users

User experience goal

The user should be able to select to receive only notifications when pipeline status changes from failed to success or vice versa.

Proposal

In this issue we want to allow user to limit Slack notifications to status changes and also correct misleading text in the existing description of pipeline trigger:

  1. Allow existing behavior but update description of pipeline trigger in the docs/UI to remove the word "status":
    • existing text: Event will be triggered when a pipeline status changes
    • revised text: Event will be triggered for every action associated with CI/CD pipeline
  2. Add the ability to be notified only when a pipeline status changes

Further details

Permissions and Security

Documentation

Availability & Testing

  • Unit test changes - Yes, existing test should be updated to check for revised text and new test should be added for new ability to trigger notification when a pipeline status changes.
  • Integration test changes - Yes, feature specs for new ability to trigger notification when pipeline status change should be created.
  • End-to-end test change - Not required

What does success look like, and how can we measure that?

What is the type of buyer?

Is this a cross-stage feature?

Links / references

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖