Debugging Gitlab CI pipelines locally
Continuous Integration pipelines are a fantastic tools to leverage in application testing and fortunately Gitlab comes with built-in Continuous Integration support. Unfortunately, tests don’t always run the same locally as they do in CI builds, and a failed test in a CI pipeline can be difficult to debug when you’re seeing different results locally. Instead of making incremental changes to your code and praying the next CI build passes, you can leverage Gitlab runners to run CI builds locally and speed up the debugging process.
Assumptions
This article assumes you already have Gitlab CI set up for your project. If not, take a look at the getting started guide, or look at this guide for more information on what Gitlab CI is and how it works.
Gitlab Runners
To execute CI jobs, Gitlab uses Runners. You can think of Gitlab Runners as individual computers that execute the jobs in your .gitlab-ci.yml
file. It’s assumed in this guide that you already have a dedicated Runner set up and connected with your project. Instead we’ll be installing a Gitlab Runner on your local machine in order to debug CI problems locally. I’ve highlighted the steps for installing a Runner on a Mac or Linux machine below, but feel free to refer back to the official guide which contains some additional details that…