gitlab-runner exec: easily test builds locally
I just pushed a brand new feature to GitLab Runner: exec.
It allows you to run the jobs defined in .gitlab-ci.yml locally!
In turn, this allows for faster testing cycles, and it makes it easier to fix broken builds.
The command supports any executor and supports all .gitlab-ci.yml options.
How to use it
- Install Bleeding Edge Runner release locally.
- Run the build:
gitlab-runner exec docker my-job.
This will run my-job defined in the local .gitlab-ci.yml in a docker container.
Using exec with Docker
- Install
docker-machine. - Create a new docker VM:
docker-machine create -d virtualbox runner - Configure shell:
eval $(docker-machine env runner)
Limitations:
- Some environment variables are not accurate: CI_BUILD_ID, CI_PROJECT_ID, etc.
Let me know what do you think about it.