I am trying to include an external GitLab CI YAML file into my project local
.gitlab-ci.yml file. The external YAML, which is in my other GitLab project
ci/cd > templates contains some workflow rules:
# ci-cd.yml workflow: rules: - if: '$TRACK != null' # TRACK is the environment type (staging/production) when: always - if: '$CI_PIPELINE_SOURCE =~ /^trigger|pipeline|web|api$/' when: always
Below is my project local
include: - '/.gitlab-ci-test.yml' - project: 'ci-cd/templates' file: 'ci-cd.yml' ...
The problem is - none of the jobs I have defined inside locally included
.gitlab-ci-test.yml get triggered when I push the changes to GitLab, even when the job has
when: always set. Seems like the workflow rules in external
ci-cd.yml are not letting the jobs run.
I’ve also tried to locally add a workflow rule to
.gitlab-ci.yml that evaluates to true, because the GitLab workflow keyword docs say
When no rules evaluate to true, the pipeline does not run.
That means if any one of the rules evaluates to true, pipeline should have run, which did not happen when I added a local workflow rule.
I hope I was clear in issue description. Would appreciate any help!