Cascade project ref for nested includes
Problem to solve
Context
We have a set of jobs and ci-templates defined in a shared CI project on our Gitlab server. In this CI-project we have templates with a predefined set of jobs for specific types of pipelines. For instance unit-tests.yml
which contains a job to run our unit-tests etc.
Problem-situation
Recently we made some changes to this CI project which caused version maintenance branches (x.y) to fail. This happened because we disabled services for our unit-tests.yml
job in the CI-project whereas the version maintenance branch still depended on the presence of services.
- [someproject/version-maintenance-branch] gitlab-ci.yml ->
include: project: "ci" file:"/predefined/full.yml"
- [ci] predefined/full.yml ->
include: project: "ci" file: "/jobs/unit-tests.yml"
- [ci] jobs/unit-tests.yml ->
unit-tests: services: [] ...
Note that the includes in the ci-project use file instead of local.
Intended solution
We wanted to fix this issue by adding tags to the CI-project and forcing our version maintenance branch to use only specific tags by using the ref key for file includes. However, it seems that refs used on the top level of nested includes do not cascade down the include-tree. Since the ref we are now using: project: ... file: ... ref: 1.0.0
is being ignored and instead HEAD
is being used just like before.
Intended users
Further details
Proposal
Permissions and Security
Documentation
Testing
Add a ref
for a file
include from a different project
. Ensure that the included file
contains more includes from said project. Verify that the nested includes use correct ref
.