[go: up one dir, main page]

Skip to content

Nested include requires ref: $CI_COMMIT_SHA?

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Background

We have multiple projects using the same .gitlab-ci.yml which is saved in a single 'ci-project'. When we load it, we just do this:

Any project's .gitlab-ci.yml

include:
  - project: remote/ci-project
    ref: <Version>
    file: main.yml

Inside ci-project, we may have nested includes:

main.yml

include:
  - project:
    ref: ?
    file: other-yaml.yml

Question

In order to keep those nested includes using the same, we seem to have to configure ref: $CI_COMMIT_SHA for all includes in that project. Is that correct?

When I was looking at the docs, it said "include:ref: Optional. The ref to retrieve the file from. Defaults to the HEAD of the project when not specified." but I was hoping that meant if I didn't specify ref, the nested includes would all be referencing the same ci-project commit from the parent but that didn't seem to be the case.

Edited by 🤖 GitLab Bot 🤖