Is it possible to include remote files that include themselves other files?
Hi there,
I have 2 projects:
- Project
automation-templates
has all the defined pipelines and jobs
automation-templates
├── .gitlab-ci
│ ├── jobs
│ │ ├── check.yml # includes the child pipelines in dir "pipelines"
│ │ ├── deploy.yml
│ ├── pipelines
│ │ ├── check.yml # includes the template jobs in dir "templates"
│ │ ├── common.yml
│ │ ├── deploy.yml
│ ├── scripts
│ │ ├── apply.sh
│ │ ├── echo.sh
│ ├── templates
│ │ ├── check.yml # uses the scripts in dir "scripts"
│ │ └── deploy.yml
│ └── variables.yml
├── .gitlab-ci.yml
Sample content of the root automation-templates/.gitlab-ci.yml
stages:
- check
- deploy
workflow:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
include:
- ".gitlab-ci/variables.yml"
- ".gitlab-ci/jobs/*.yml"
Sample content of the file automation-templates/.gitlab-ci/jobs/check.yml
check:
stage: check
trigger:
include:
- local: "/.gitlab-ci/pipelines/check.yml"
strategy: depend
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- Project
my-app
where I would like to use the pipeline declared inautomation-templates
(see above) by having this followingmy-app/.gitlab-ci.yml
include:
- project: automation-templates
ref: main
file: .gitlab-ci.yml
This is working for the 1rst level of inclusion. Indeed I have my pipeline triggered in my-app
as the my-app/.gitlab-ci.yml
includes the remote automation-templates/.gitlab-ci.yml
But it does work at the level of the included files /.gitlab-ci/jobs/*.yml
(on remote project automation-templates
because I got this error on my-app
pipeline
Found errors in your .gitlab-ci.yml:
Local file `/.gitlab-ci/pipelines/check-talos.yml` does not exist!
I tried many configurations like indicated in the online documentation without success.
So I would like to know if such kind of use case should work in GitLab? This is a possible feature and I misconfigured something or it could be a bug in a “corner case”?
Thanks for your help.