Skip to content
GitLab
Next
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • GitLab.org GitLab.org
  • GitLab GitLab
  • Issues
  • #332501

Automatic brach pipeline cancellation when merge request pipeline is created

Proposal

Relates to the duplicate pipeline filtering feature variable CI_OPEN_MERGE_REQUESTS, see: !38673 (merged)

Using this workflow helps eliminating duplicate pipelines when pushing branch updates:

workflow:
  rules:
    - if: $CI_MERGE_REQUEST_IID
    - if: $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

There's still one issue with duplicate pipelines with the following use case:

  1. Create changes and push to development branch. This starts a branch pipeline.
  2. Create merge request for the branch. This starts another pipeline which is a MR pipeline. If this MR is created while the first pipeline is running there's duplicate pipeline which is not automatically canceled. Project automatic pipeline cancellation does not seem to affect this. Apparently it is considered different due to different trigger or some other reason.

We should have a way to automatically cancel these obsolete branch pipelines when MR pipeline is started. By default the behaviour could be to cancel the possibly running branch pipeline if a MR pipeline is started for the same branch. Since this would affect also projects using both branch and MR pipelines this might not be possible. But could we at least have a command or configuration to enable this automatic pipeline cancellation?

Assignee
Assign to
Time tracking