Using runner id as a resource group

In my organization we’re using resource_group to limit the number of jobs accessing hardware on our runners host machine.

Using something like resource_group: hardware-testing works as expected but it doesn’t scale to multiple runners. Ideally we’d like to add additional runners and still maintain a resource_group on a per runner basis.

So naturally we tried setting resource_group: $CI_RUNNER_ID but this does not seem to perform as expected. It appears like the resource_group is ignored and all jobs just run in parallel.

Reviewing the docs I see no mention as to why this shouldn’t work? What am I missing?

Any help or recommendations on other ways to achieve this is appreciated! Thanks!

That’s probably because the $CI_RUNNER_ID is only known after the job was assigned to a runner. So the resource was already assigned.

But did you solve your problem? I’m looking for a solution, too. Having problem with some jobs running on the same runner hosts parallel.