CasinoRoyale
CasinoRoyale

Reputation: 51

Is it possible to specify a gitlab runner by name?

We have multiple runners that share a tag, and these tags can't be changed because of workplace policies. So we currently have something set up like this:

#12345 (Foo) tag: foobar

#23456 (fOo) tag: foobar

#34567 (foO) tag: foobar

However when we run a job using the "foobar" tag, it sometimes fails solely depending on the runner that gets chosen. I ended up running the pipeline a dozen or so times to check, and runners #12345 and #23456 always end up failing, even when the build is fine. The #34567 runner succeeds when the build is fine and fails when the build isn't. The runner documentation says I can specify the runner by name, but looking over the keyword reference documentation I'm not seeing how to specify it.

Upvotes: 4

Views: 5607

Answers (2)

sytech
sytech

Reputation: 40861

No. The documentation is misleading. You can only use tags to limit what runner(s) your jobs run on.

The only other way you might have around this would be to register your own runner(s) for your project/group, giving them the tags you need. Though, I doubt that's an acceptable solution for obvious reasons.

Ultimately, your GitLab administrator will need to configure your runner(s) to have an additional tag by which you can uniquely identify the runner(s) if you want to be able to have your jobs use a specific runner out of your shared runner pool.

Upvotes: 1

Davide Madrisan
Davide Madrisan

Reputation: 2300

It's not possible. The runners can only be selected by tags and runners with an identical tag should be homogeneous in terms of software versions and hardware. The fist one that is ready to take your CI job will run it. So one should never need to select a specific runner, in a group that share a single tag.

Each job may known the runner executing it by looking at the environment variable CI_RUNNER_ID, but this is not usable for your purpose. Unless you force a job failure if the runner is not the "good" one, and retry it until it will be randomly taken by the runner you want. But of course this would be a weird solution.

Upvotes: 1

Related Questions