Gitlab-ci stages and runners

I’m trying to build out a CI process containing multiple stages, e.g. build, test, save, and cleanup docker images.

The problem I am seeing is that, according to my reading of the documentation, there is no way to guarantee that each stage is going to run on the same host in an environment where multiple runners exist for load balancing.

If I have a build stage that does docker build, test that does docker run && docker exec, save that does docker push, and cleanup that does docker stop && docker rm, this would work perfectly, as long as I have only one possible gitlab-ci runner.

However, if there are two or more possible gitlab-ci runners for each job, what I get from reading the documentation is that build may run on one of the runners, test may run on another, etc, etc.

Is there any way to overcome this issue?

1 Like

Similar to questions raised in Gitlab-ci.yml when on_failure on_success

The short answer to your question is, no, there is no guarantee that any job, much less any stage, will be run on any particular runner. Jobs are run in parallel.