Ability to expand variables in .gitlab-ci.yml "include" directive

Hi,

I am using a simplistic .gitlab-ci.yml with the include keyword to remotely fetch the build config from a centrally managed location. This URL must contain some project-specific parameters such as the project ID and a token. I have the token defined in Settings -> CI/CD -> Env variables but it doesn’t seem like Gitlab expand the variables so I can do like this:

include: ${API_URL}/buildconfig.yml?token=${API_TOKEN}&pid=${CI_PROJECT_ID}&ext=.yml

Is this supposed to work or not supported? Since variables expansion works elsewhere in .gitlab-ci.yml I assumed it would work for the include keyword as well.

Having to hard-code the values is not ideal.

1 Like

Hi, I am trying to do something similar as well. I want to add variables like my remote include so that my server can generate ymls.

include:

It appears to not work right now :frowning: . I would LOVE if this was possible. Otherwise I’d need to work out some other magic around Gitlab CI’s limitations.

Edit: Apparently it’s an issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/52972