CI/CD variable referencing another variable not expanded when used for job tag despite Expand variable reference being set
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
While it is possible to use a variable as a value for a job tag: attribute, if the variable is itself based on another variable it is not expanded, and the tag value is set to $VAR and the job gets stuck.
The ability to set a tag using a variable based on another variable is useful when wanting to template runner deployments and trigger switching of runners during outages.
Steps to reproduce
- Define two project CI/CD variables:
- Configure a pipeline:
stages:
- build
build-job:
stage: build
tags:
- $MY_RUNNER
script:
- echo "Compiling the code..."
- echo "Compile complete."
- Observe that the job remains in stuck state looking for a runner with tag of
$RUNNER_VAR:
Example Project
What is the current bug behavior?
Tag variable is not expanded to include other variable.
What is the expected correct behavior?
Variable expansion should be applied to tags as it is to the variables sent to the runner.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)

