How does GitLab choose a runner when the job tags match more than one runner?

How does GitLab choose a runner when the job tags match more than one runner?

I cannot find any documentation to explain the expected behaviour when job tags match more than one runner.

The example a-runner-and-a-job-have-multiple-tags demonstrates a scenario with a single runner and job, but what is the expected behaviour when the job maps to more than one runner.

For example, runner A has the tags “abc” and “xyz” and Runner B has the single tags “abc”. If a Job has the single tag “abc” which runner will pick up the task?

It’s basically random.

Every few seconds (the exact period is configurable) each runner checks in with the GitLab server and if it has resources (I think it only looks at how many jobs it has running already, the number of concurrent jobs it can run is configurable) asks for jobs (matching it’s tags, but you seem to know how that works). When multiple runners have the same tags, it’s basically random which will check first, if you need to know more, it’s probably better to read
the documentation on advanced configuration of runners

2 Likes

Thanks for the quick response.

Yes it seems random to me too.