Skip to content

Enforcing successful pipeline before merge can be circumvented by skipping CI

Summary

Branches with skipped pipeline can be merged even though Only allow merge requests to be merged if the pipeline succeeds is active.

Steps to reproduce

  1. Have a project with the setting Only allow merge requests to be merged if the pipeline succeeds for Merge Requests active and a CI pipeline set up.
  2. Create a branch and push it with any commit message containing [skip ci]:
git checkout -b skipping-branch
git commit --allow-empty --message '[skip ci] Demo commit'
  1. Create a merge request for that branch
  2. In the merge request, notice that you can click the merge button

Example Project

https://gitlab.com/mauricemeyer/merge-without-pipeline/merge_requests/1

What is the current bug behavior?

I can merge the MR when the pipeline was skipped. It even works when the pipeline before the skipped one failed.

What is the expected correct behavior?

I can’t merge the MR because there is no successful pipeline run for the latest commit.

Relevant logs and/or screenshots

Screenshot_2019-02-06_at_15.27.08

Output of checks

  • This bug happens on GitLab.com
  • This bug happens in GitLab Enterprise Edition 11.6.8-ee

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:         Ubuntu 16.04
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.5.3p105
Gem Version:    2.7.6
Bundler Version:1.16.6
Rake Version:   12.3.2
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.3
Go Version:     unknown

GitLab information Version: 11.6.8-ee Revision: d43a883 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.11 URL: https://[redacted] HTTP Clone URL: https://[redacted]/some-group/some-project.git SSH Clone URL: git@[redacted]:some-group/some-project.git Elasticsearch: yes Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 8.4.3 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

All checks pass.

Edited by Maurice Meyer