Live data from Hacker News

Show HN: Test your Gitlab CI Pipelines changes locally using Docker

github.com

11–20 of 41 posts

Re: Show HN: Test your Gitlab CI Pipelines changes locally using Docker

#11

Why not just use GitLab's runner[0] directly for this? gitlab-runner exec docker [0]: https://docs.gitlab.com/runner/install/

Yeah I thought about that, but gitlab-runner doesn't allow to "share" cache or artifacts between jobs so it's not a good fit to test multiple-jobs workflows.

Haven't test the tool yet. Neither do I know how close the behaviour of the pipeline locally will differ on the server.

Saying that, pipeline test tools are very much needed. Making commits and refreshing a UI is not practical.

I can test a distributed pipeline on spark why can't I do that with modern CI/CD?

Re: Show HN: Test your Gitlab CI Pipelines changes locally using Docker

#14

Great idea. One question - what pain point is this solving? As a GitLab, GitLab Pipeline and Docker user I don't find running pipelines that slow to run or initiate

You continuously need to push your changes to change `.gitlab-ci.yml` and find out if your change is working? E.g. your docker run command. I haven't tried out the tool yet but I hope it will save time and avoid me pushing 100s of commits to sort out my pipeline changes.

Re: Show HN: Test your Gitlab CI Pipelines changes locally using Docker

#17
Nice! I made a similar tool a while back:

https://gitlab.com/rhn/cirunn

It's a pair of really simple Python scripts: cirunn.py for executing locally, an ciorder.py to execute stuff via ssh on another host (useful for projects that are too big for the laptop).

The main advantage is that podman does not need root access at all, making it both easier to use and more secure.

Also, no installation.

The difficulty I found here is deciding what the user actually means to run: is it more like `make test`, where the current state of the working directory is tested, or more like the CI pipeline, where only committed changes are tested?

For the sake of practicality, the local script tests uncommitted changes, and the remote one checks the last commit.

Re: Show HN: Test your Gitlab CI Pipelines changes locally using Docker

#18

Great idea. One question - what pain point is this solving? As a GitLab, GitLab Pipeline and Docker user I don't find running pipelines that slow to run or initiate

The problem is not necessarily slow init, but some pipelines are just long and complex.

If you have a problem in your deployment script, for example, you might need to wait a long time to test and fix it.

Post reply on HN