GitLab Runner/CI Required Tags - only run jobs with required tags
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Description
In some cases I want a GitLab Runner to only run a job if it is tagged with each of the required tags.
For example, let's say I have two runners setup:
- Kubernetes executor
- Docker executor with privileged mode set to
true
(for Docker Build) - run untagged buids:false
, tag:docker-build
In this case I want all jobs to go to the Kubernetes executor except those that explicitly need Docker Build and have opted in to the less secure build environment by specifying the docker-build
tag in the .gitlab-ci.yml
file.
I can imagine other scenarios where you'd want to have multiple required tags such as for runners that spins up a VM for each build but you only want jobs that specifically require a VM to use that runner. E.g. one runner has required tags vm
& windows
whereas the other may have vm
and linux
.
Proposal
Add "Required tags" field to Runners. Runner will only pick up jobs that contain each of the required tags. [Optional] tags and required tags should be usable together (e.g. two runners have identically required tags but different optional tags and job wants way to specify which to use)
Links / references
Could potentially help with https://gitlab.com/gitlab-org/gitlab-ce/issues/29174 & https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/2215 also.
Documentation blurb
GitLab Runners can be configured to only run jobs that contain one or multiple required tags. For example, if you wanted projects to specifically opt in to using a specific runner (e.g. perhaps it isn't a secure runner) you could make that a required tag then no jobs would run on that runner that did not contain the required tag.