allow variable substitution in CI tag names
Description
I wrote the following .gitlab-ci.yml:
deploy:
stage: deploy
environment:
name: $CI_BUILD_REF_NAME
only:
- /^env-.*$/
tags:
- deploy
- $CI_BUILD_REF_NAME
I was expecting a deploy to run on a runner with a tag name the same as the name of my branch (to have the proper environment's deployment variables securely injected).
Instead, I got a hung build where it was looking for a runner with the tag $CI_BUILD_REF_NAME.
Proposal
When evaluating a .gitlab-ci.yml file to schedule a job, first perform variable substitution prior to the logic used for selecting a runner.
Additionally consider implementing regex-style variable manipulation as proposed in gitlab-foss#24044 (closed). These two improvements combined would be especially powerful.