Disabling pipelines when only_allow_merge_if_pipeline_succeeds is true locks existing merge requests
Summary
Having a project with Pipelines enabled, project[only_allow_merge_if_pipeline_succeeds]
set to true, and an existing merge request.
If the pipeline fails or is cancelled, disabling Pipelines will simply lock the merge requests, until the user re-enables Pipelines, and removes the check from project[only_allow_merge_if_pipeline_succeeds]
.
Steps to reproduce
- Create a new project
- Create first commit
- Create a new branch
- Commit a change to the new branch
- Create a merge request from the new branch to master
- Enable Pipelines [in Settings » Permissions] if not yet enabled
- Check "Only allow merge requests to be merged if the pipeline succeeds" [in Settings » Merge request]
- Enable Auto DevOps [in Settings » CI / CD » Auto DevOps] or setup the pipeline by adding
.gitlab-ci.yml
- Cancel the pipeline or make it fail
- Disable Pipelines [in Settings » Permissions]
- The merge request will now require you to pass the pipeline, although Pipelines is disabled
Example Project
The bug first appeared on an old version of on-premise Gitlab, so I checked it on gitlab.com and it happened exactly the same way.
So I created a merge request that demonstrates the described state: uda/testing!1
What is the current bug behavior?
Merge requests get locked.
What is the expected correct behavior?
The value project[only_allow_merge_if_pipeline_succeeds]
should not be checked on merge requests if Pipelines is disabled.
Possible fixes
Make checking only_allow_merge_if_pipeline_succeeds
in merge requests based on pipelines, as it should.