We run gitlab 14.0.5 and I wanted to use some of the more recent features with our mono repo. What I set up so far is:
---
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
build-proj1:
stage: build
trigger:
include: applications/proj1/gitlab-ci-pipeline.yml
strategy: depend
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- applications/proj1/**/*
# only:
# variables:
# - $CI_COMMIT_TAG == null
# - $CI_COMMIT_TAG =~ /^proj1@.*$/
# refs:
# - merge_requests
# - branches
# - tags
# changes:
# - applications/proj1/**/*
build-proj2:
stage: build
trigger:
include: applications/proj2/gitlab-ci-pipeline.yml
strategy: depend
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- applications/proj2/**/*
# only:
# variables:
# - $CI_COMMIT_TAG == null
# - $CI_COMMIT_TAG =~ /^proj2@.*$/
# refs:
# - merge_requests
# - branches
# - tags
# changes:
# - applications/proj2/**/*
With this, any change to the merge requests triggers both child pipelines, which is not the desired outcome.
When I leave out the include, the same code creates empty child pipelines, which fail because no job gets created.
If I replace rules
with only
as seen in the commented out sections, it works as intended without variables
but as soon as I add the variables section, again all pipelines are started, probably because only
reacts on any match.
So I really would like to mix rules
with triggers and not fail the child pipelines whenever no change has been done in the listed directories.
Am I doing wrong or is the described behaviour a bug in Gitlab-CI?