Skip to content

only: merge_requests removes all other jobs from the MR pipeline

stages:
  - build
  - test
  - integrationTest

myBuild:
  stage: build
  script:
     - ./build

myTest:
  stage: test
  only:
    - merge_requests
  script:
    - ./test

myIntegrationTest:
  stage: integrationTest
  only:
    - merge_requests
  script:
    - ./test

Expected result:

1. For merge requests:

build - test - integrationTest

image

2. For pushes without merge requests:

build

image

Actual result

(Please ignore the job state successful/pending/failed, it is all about the job count)

1. For merge requests:

Only the myTest and myIntegrationTest stages are shown in the pipeline:

test - integrationTest

image

If I click on the commit hash, I see that actually, two separate pipelines are running: one build, the other one build - test - integrationTest

image

2. For pushes without merge requests:

As expected, only the build step

Further information

The CI linter shows me the following:

  1. If I don't use the only: merge_request in any job, all jobs are shown in the linter as Only policy: refs, branches, tags
  2. If I use the only: merge_request in the test jobs, the build job still has Only policy: refs, branches, tags and the test jobs Only policy: refs, merge_requests

The Gitlab instance is not publicly available

Edited by Philipp Hasper