So I have a gitlab yml file and there I define two anchors each with their own rule:
.mr_event_with_path1: &mr_event_with_path1
variables:
<<: *base_variables
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_PROJECT_PATH == $PATH1
when: always
- if: $CI_PIPELINE_SOURCE == 'web'
when: always
tags:
- myTag
.mr_event_job_base: &mr_event_job_base
variables:
<<: *base_variables
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
- if: $CI_PIPELINE_SOURCE == 'web'
when: always
tags:
- myTag
setup_environment:
<<: *mr_event_job_base
stage: .pre
needs: []
script: # bla bla
runpath1:
<<: *mr_event_with_path1
stage: .pre
needs: []
script: # bla bla
The idea is that I then define general jobs and use the anchor mr_event_job_base
. And I got some specific jobs only to be run when the project path is some specific project $PATH1
.
It works fine when the project path is indeed $PATH1
, here I see all jobs running including setup_environment
, however, when the path is not $PATH1
I dont see any jobs at all
Is there anything wrong with the above, or does GitLab not support mulitple anchors each with their own rules..