Search code examples
includegitlab-cirulesgitlab-ci.yml

gitlab-ci: Including external jobs only for merge requests


I'm trying to configure a CI pipeline which includes jobs from other project, but only for merge requests. According to GitLab documentation, I can use rules with include and $CI_PIPELINE_SOURCE is supported there, however the following doesn't run the included jobs at all:

include:
  - project: "configs/gitlab-ci"
    file: "checks.gitlab-ci.yml"
    rules:
      - if: $CI_PIPELINE_SOURCE == "merge_request_event"
        when: always

Using the same rules I can pick locally defined jobs to be run in merge request, but it doesn't work for include. I haven't really found anything useful on the topic, apart from the documentation linked above.

How can I make include work only for merge requests?


Solution

  • I've found a GitLab issue describing this problem: gitlab-org/gitlab#393232 so it seems this is at least for now broken.