Pipelines run twice for merge request branches: a branch pipeline and an MR pipeline.

IntermediateScenarioGitLab CI
Answer

Situation read → Duplicate pipelines from overlapping triggers.

What I'd do →

  1. Use the recommended workflow rules:
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH
  1. Confirm results with the pipeline source in the UI.

Why → Branch pipelines are suppressed when an MR is open, so only one pipeline runs.

Interview tip → Know CI_PIPELINE_SOURCE values.

All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI