Loading
POC: Solve duplicate MR pipelines
What does this MR do and why?
POC: Add prevent_duplicate_mr_pipelines project setting
When pushing to a branch with an open merge request, GitLab creates both a branch pipeline and a merge request pipeline. This causes confusion, wastes CI/CD resources, and creates compliance gaps.
Add a new opt-in project setting prevent_duplicate_mr_pipelines.
When enabled:
- The branch pipeline is suppressed at
BaseHooksService#create_pipeline?before any CI config parsing or Sidekiq job is enqueued. - The implicit
only: [branches, tags]default is stripped from jobs without explicit rules/only/except, so they are included in merge request pipelines. - Only push-triggered pipelines are affected. Manual, API, scheduled, and triggered pipelines are unaffected.
References
Create at most 1 pipeline when in the context o... (gitlab-org#6044)
How to set up and validate locally
- Create an invalid CI Config to a project
- Create an MR with some changes
- See the duplicate pipelines
- Make another change on the MR branch
- See the duplicate pipelines again
- Enable the setting
- Make another change on the MR branch
- See no duplicate pipelines
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.







