Richard Friend opened issue #67470: nested includes from remote at GitLab.org / GitLab FOSS

Richard Friend
2019-10-29T15:12:10Z

When including files from remote repo and those files themselves wish to include files within same remote repo (local to them), this doesn't seem to be do-able.

For example in .gitlab-ci.yml

include:
- project: build/pipelines
file: /vault/include.yaml
ref: npm-publish

Then inside that include.yaml i want to include a set of files from same repo so consumer does not have to individualy include lots of files.

include:
- local: "/vault-nexus-npmrc-template.yaml"
- local: "/config.yaml"
- local: "/vault-read-nexus-secret-template.yaml"
- local: "/vault-read-secret-template.yaml"

This doesnt seem to work as it takes local as meaning local to the project with .gitlab-ci.yml in it, where as instinct tells us its local to the project it resides in (build/pipelines).

Okay so change them from local to project (a bit smelly)

include:
- project: build/pipelines
file: "/config.yaml"
- project: build/pipelines
file: "/vault-nexus-npmrc-template.yaml"
- project: build/pipelines
file: "/vault-read-nexus-secret-template.yaml"
- project: build/pipelines
file: "/vault-read-secret-template.yaml"

Now this is no good as its lost the ref specified in .gitlab-ci.yml and i cant hard code the ref as i would want it to match the ref in the consuming .gitlab-ci.yml

It would be great if there was a way to indicate that local means local to the source repo not the end project, in the case of any file being pulled from a remote repo local should mean local to that remote repo not the project with .gitlab-ci.yml in.