gitlabgitlab-ci

Cannot use GitLab project variable in include


I'd like to use GitLab project variable with include in my YML file, as described in GitLab docs. But I've got the following error message:

Pipeline cannot be run. Project mygroup/another_project reference `` does not exist!

I cannot realize what's wrong.

What I've done:

  1. I've created FOO variable in my project and set its value to master.
  2. And created the default .gitlab-ci.yml file to include YML from another project,

as the following:

include:
  - project: 'mygroup/another_project'
    ref: $FOO
    file: '/git/gitlab-ci.yml'

However, when I try to run a new pipeline (manually, via "Run pipeline" button), I've got the following error message:

Pipeline cannot be run. Project mygroup/another_project reference `` does not exist!

So it seems like FOO variable is not set, or isn't propagated into my YML file when I try to run a pipeline. AFAIU GitLab docs say it should work.

What am I doing wrong here?


Solution

  • After weeks of trying, we ended up with reinstalling/upgrading Gitlab server. I don't know the reasons of the issue, I guess it is related to a wrong installation done previously.

    Now I confirm that project variables (as well as group variables) are propagated OK to a pipeline and can be used with include: at least for GitLab Enterprise Edition v16.11, as described in GitLab docs, like the following:

    include:
      - project: 'mygroup/another_project'
        ref: $FOO
        file: '/git/gitlab-ci.yml'