Make the workflow to avoid duplicate pipelines in merge requests easy to use

🧩 Problem

Earlier (before #201845 (closed) was worked on) users often witnessed multiple pipelines being run for their push to a given branch, one for the merge request, another one for the branch. Now by defining rule with CI_OPEN_MERGE_REQUESTS and $CI_MERGE_REQUEST_IID this can be avoided. Each time users want to configure their settings to avoid running run multiple pipelines on a push, they have to add a rule like one of the following to their .gitlab-ci.yml:

  • workflow:
      rules:
        - if: $CI_MERGE_REQUEST_IID
        - if: $CI_OPEN_MERGE_REQUESTS
          when: never
        - if: $CI_COMMIT_BRANCH
  • workflow:
      rules:
        - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
          when: never
        - when: always

This is understandable for users who are comfortable with the technology but difficult to use for others.

Current state/next steps

grouppipeline authoring is working to resolve this in #300146 which may resolve this issue. If it does this will be closed as a duplicate.🎉

Design Proposal(Expectations)

  • Define a default behaviour for the situation
  • Determine if any controls should be provided through the project settings
  • Propose a simpler workflow to add the rule to the configuration
Edited by James Heimbuck