Manual replay of CI stages locally using gitlab-runner exec with dependencies and custom docker flags
We often need to manually re-run a stage from one of our CI pipelines. For example to apply formatting locally using the same tools used in CI (mounting a local directory into docker with the -v
option) or to reproduce and interactively debug a CI failure (running docker with the -it
options).
One nice property of the Kubernetes and Docker executors is that it is generally easy for a user to run the Docker image locally and replay the steps in the script in the .gitlab-ci.yml file. However, when a CI stage has a dependency (i.e., with needs
) on artifacts of a prior stage this becomes impossible. Can you suggest a methodology for locally manually re-running CI stages with dependencies? Can or does GitLab maintain a command line tool for Linux which could be used to do this (allowing passing flags through to Docker)?
So to summarize:
-
the ability to pass the docker -v
flag togitlab-runner exec
for local mounts -
the ability to pass the docker -it
flag togitlab-runner exec
for interactive debugging -
gitlab-runner exec
of a stage automatically populates dependencies for that stage
The above would greatly increase our efficiency at using GitLab CI to (1) reproduce CI results locally (2) debug CI tests locally, and (3) write new CI stages.