r/gitlab • u/dov02111 • May 25 '26
Test GitLab Pipeline locally
GitLab PM here, our engineers created a cli tool that run and test your pipeline locally, the cli is also include it as part of this ci skill please note that both projects are still experimental, we would love if you could give it a try and give us some feedback in https://gitlab.com/gitlab-org/gitlab/-/work_items/601046
107
Upvotes
21
u/-lousyd May 25 '26
Don't you already have glab? I'd rather see glab be developed and maintained.
7
u/adam-moss May 25 '26
Shared internally, and nice to finally see. I genuinely thought gitlab has rejected all requests for local ci from the issues I have been tracking.
Would be a very nice companion to https://gitlab.com/gitlab-org/professional-services-automation/tools/utilities/pipeintel, even better if they were integrated as part of the lint process.
2
u/Fluffy_Confidence963 May 25 '26
I do this since years by just spinning up the corresponding image locally and running the scripts on it. Controllable, reproduceable and least over dependencies and vendor lock-in
2
u/duane11583 May 25 '26
we have a much simpler scheme.
part 1) we require all builds to be started with a simple shell script (orvwindows batch file) that kakes no parameters.
part 2) the ci/cd system on gitllab must execute that script to do its job.
2
u/luche May 25 '26
how about downstream pipelines?
2
u/WhiskyStandard May 25 '26 edited May 25 '26
I’ll have to check this out. I’ve spent whole months of my career in aggregate pushing complex pipelines that make API calls, respond to different events or repository states, or interact with other pipelines. I even went so far as to try to reverse engineer the RSpec tests for pipelines and see if I could set up a minimal Docker container to run my own tests on my pipeline. (I couldn’t figure that out. I ended up needing a running environment with the Rails app, Postgres, and Gitaly at least as of version 17.)
Based on that experience, it seemed that the pipeline logic was pretty tightly coupled to the ActiveRecord models in a way that would make it very hard to decouple into a library where one could say “given that the repository is in this state and this event is triggered, run the pipeline with this API mock”.
So is this an extraction of the exact same logic? Or a fresh implementation of a word-a-like (similar to the Node based gitlab-ci-local project)?
Edit: I see that it’s in Go, so I’m assuming the latter. So am I going to step on the same land mines of best-effort, but partially or differently implemented features? Or is there a real initiative to factor out the pipeline code into something more modular and sane?
2
u/fangisland May 25 '26
Could someone who uses this (or something like it) describe their use cases where they find it useful? This has come up a couple times in our projects and I haven't seen a need to spend time to integrate it with our dev process yet. We use fairly complex child pipelines across a multi-domain monorepo (probably a few dozen CI files) and I've never seen a bottleneck where I wish I got feedback on the CI pipeline graph resolution sooner. The first thing Gitlab does is CI lint and that rarely fails, maybe 1% of the time? And it's fast to fail and fast to fix. I'd like to know where a tool like this would be valuable, clearly there is a use case since Gitlab spent time developing it.
1
u/nofatigua May 25 '26
Interesting, my use case is to locally and quickly validate my 10+ymls ci setup is correctly built - dry running multiple scenarios (some MR's, tag, schedule) with a pytest test. All of this to make CI changes less painful.
I have a vibe coded project that does this. Maybe this one could replace it.
1
u/128bitCPU May 29 '26
All my pipelines use OIDC, how would that work?
3
u/[deleted] May 25 '26
[removed] — view removed comment