Mapping environments to runners

Its not clear how .gitlab.yml knows what runner to use for a given stage

I have 2 production servers.
I named them:
“admin production” & “node production”
I tagged them both as “production”

In my yml I have
environment:
name: admin production
url: http://admin.xxxxxxxxxx.com

but it uses the “node production runner” !!!

The docs say:
“The environment keyword is just a hint for GitLab that this job actually deploys to this environment’s name”

How do I ensure gitlab chooses the correct runner/server?

Hi Dylan,

you mean .gitlab-ci.yml, didn’t you?
From my point of view you misunderstood the way gitlab runners work. The idea is that you can have an unlimited number of runners. Each runner have tags. These tags define the ability of the runner to build a certain job. If your job for example needs nodejs and grunt to be build you should use these tags in your .gitlab-ci.yml.

Then GitLab CI searches for runners whith the desired tags and use them (I don’t know the logic which is used to select a runner, but you can not define which one will be used).

See https://docs.gitlab.com/ee/ci/runners/README.html#use-tags :wink:

Markus