Hello,
I have several runners on my self-hosted GitLab instance and I noticed that jobs are load balanced between runners available.
I would like to do the following:
1 - Pipeline started, an available runner is chosen
2 - Jobs in this pipeline should be run on the same selected runner
Why ?
My jobs contain some built Docker images used in next jobs. So if the first job runs on server A and the next on server B, my pipeline will fail as the server B doesn’t have the built image.
Thank you very much for your help.
Have a nice day
You can either tag all the jobs in the pipeline to use a runner with a specific tag (e.g. my-special-runner), or what is usually done - push your built image to the Container Registry (e.g. with branch name or commit hash as a tag) and then use it in your next job.
Thank you.
Sadly using a container registry will slow down my pipeline.
I guess using a unique runner is my best solution.
Do you know where I can suggest such a feature ?
I am looking for the same feature. Have you requested it already?
My attempt was described here, but it didn’t work either:
I tried to request this specific method here, but it was solved as not planned:
I think we need a more general request and keep the actual solution open. By actual solution I mean, how runner selection is finally done from a user perspective, e.g. by a runner_selection job or by grouping jobs somehow, etc. I don’t know what’s the best way to move this forward, but we definitely need a request.
Images need to be stored in a container registry to be useful otherwise why were they built?
and pulling an image that already exists locally is a no-op.
Storing in a container registry between job stages is the correct solution.
The alternative that might be better is to separate the gitlab runners from the docker builders. Docker buildx is very sophisticated and can properly streamline multiple Dockerfile builds at once. If you have your own infra and docker builds are a big part of what you do, rather than using docker:dind or local /var/run/docker.sock to perform builds, all your docker builds should be directed to a dedicated docker buildx server or server pool.
You still need a docker registry to persist the images as artifacts