GitLab CI/CD 1 · When jobs run

Avoid duplicate pipelines

Run branch pipelines only when there is no open merge request.

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

Official GitLab CI/CD 1 documentation

More when jobs run commands

All when jobs run commands · GitLab CI/CD 1 cheatsheet

Was this page helpful?