Why it's not possible to use $VARIABLE inside url in include pipeline

Why it’s not possible to use $VARIABLE inside url in include pipeline

I would like to generalize my pipelines, and in my architecture I would need to define an $URL variable at the gitlab instance level (or project level) and use it in my import.

Do you know if there is a way to use other variables than the predefined ones as explained in the documentation https://docs.gitlab.com/ee/ci/variables/where_variables_can_be_used.html#gitlab-ciyml-file

gitlab-ci.yaml

include:
  - $URL/jobs/name.yaml

I can’t find the embedding code part in the ruby code of gitlab either.

Thanks you ! :blush:

Hi @AYDEV-FR
Nope, if it’s not implemented it can’t be done.
If the $URL should be the GitLab server, you can use the predefined variable CI_SERVER_URL

Thanks you @balonik for your response,

However, my URL is not Gitlab server Url ( CI_SERVER_URL ).
It would be too easy :sweat_smile:

Do you know why this has not been implemented? Any particular technical reason?
I have seen on the internet several people wanting this.

I don’t know. I guess you just have to wait until it gets higher on the backlog. If you have a paid subscription you can make it higher priority by contacting GitLab support.

According to Use CI/CD configuration from other files | GitLab using instance or project level variables should be possible.

With a small workaround (kudos to @dbogatov) this is also possible for variables defined in the global variables section of a .gitlab-ci.yml file itself, such as:

variables:
  ACME_CI_TEMPLATES_BRANCH: &ref 'stable'

include:
  - project: acme/gitlab-ci-templates
    file: maven/.gitlab-ci.yml
    ref: *ref
1 Like