====== dynamic runner tag ======
Variable expansion in tags works.
Simple runner tag can be set as shown:
variables:
RUNNER_TAG: "staging"
job:
tags:
- $RUNNER_TAG
tags:
- ${CI_COMMIT_BRANCH}
Not possible to define array of strings as variable:
variables:
RUNNER_TAG: [ "staging", "test" ] # LINT ERROR
job:
tags: $RUNNER_TAGS
[[https://stackoverflow.com/questions/65850715/how-to-set-a-dynamic-gitlab-job-tag-with-a-variable|How to set a dynamic gitlab job tag with a variable?]]
===== run pipeline on the same runner =====
It is not possible to detect runner tag during yaml variables expansion because gitlab doesn't schedule jobs. Gitlab-runners periodically connect to Gitlab servers
and asks for jobs.
It is possible to check what runner got our job from environment variable:
CI_RUNNER_TAGS=["linux", "docker", "small", "medium"]
and this variable can be used to generate yaml file for new dynamically generated child pipeline.