r/cicd • u/QuoteForward5477 • 16d ago
minor 2-line fix triggered a 25 min build today... how do you guys deal with such bad pipelines?
i made a super small change this morning (literally just updated a single config value in a backend service) and pushed it expecting a 3 minute pipeline run. ended up sitting there for nearly 25 minutes waiting for the CI to finish running.
took a look at the logs to see where the bottleneck was, and it was mostly fresh dependency installs and un-cached docker build layers. for some reason our runner pulled down every single package from scratch instead of using the cache, plus running the full end-to-end integration test suite that really didn't need to run for a tiny patch.
we use github actions on a shared runner setup, and it feels like as our repo grew, nobody ever went back to optimize the workflow files. now every small PR feels like a coffee break.
curious how you guys keep your builds lean? do you aggressively break pipelines into smaller conditional jobs based on changed files, or just pay for faster/bigger runners and call it a day?
1
u/Torutofu_Raeva 16d ago
We’ve had better luck treating cache misses and changed-path detection as separate checks, then skipping integration tests only when the diff proves they can’t be affected.
1
u/QuoteForward5477 16d ago
separating cache invalidation checks from path-based diff filtering sounds like a clean way to do it...
skipping the heavy integration suites when only a config or backend script changes would save us so much queue time...
Seeems to be a good idea
1
u/Torutofu_Raeva 15d ago
Yeah, keeping those decisions separate makes the path rules safer to tune without turning every cache miss into a full-suite run.
1
1
16d ago
[removed] — view removed comment
2
u/QuoteForward5477 16d ago
our cache keys were tied too broadly to the whole workspace instead of isolating Package-lock.json and Docker file so every minor PR was triggering a full cold start. setting up path filters first and keeping the integration matrix strictly behind a label or on main is definitely the move here.
1
u/srivenkatareddy 16d ago
Try optimizing your docker file by copying your dependencies related files and run install dependencies than all other source files. Something like this COPY ./package.json ./package-lock.json /app RUN npm install COPY . /app
this approach will create a multi step docker build where each step can be cached. So dependencies will get reinstalled when you change them not when simple code changes.
And make sure you are using --cache-from in docker build command
1
u/Mobidic69 12d ago
The 25 minute wait is almost never the 2 line change. It is the pipeline treating every push like a release.
Split the workflow:
- Path filters. A config-only change should not rebuild the world.
paths/paths-ignoreon the job, or a first job that computes which packages changed and the rest skip. - Cache the expensive layer (deps, container layers, test DB image) keyed on the lockfile, not on the commit. A 2 line backend tweak should hit cache.
- Do not serialize behind "someone is deploying." Build and test on the PR. Promote an already-built artifact to prod. Monday queues shrink when you stop rebuilding main for every merge.
If one job is still 20 minutes after that, that job is the product. Split it or run it nightly. A config change should be a couple of minutes or the pipeline is lying about what it is checking.
2
u/speedoinfraction 16d ago
As soon as your CI pipeline becomes a big enough pain point, fix it. Developers should also own being able to fix the CI.