A pipeline works on one runner and fails on another. The expected result may have lived in a local cache the team implicitly treated as reliable storage. That confusion becomes particularly expensive during a release.
Cache accelerates work; an artifact transfers an identified result. GitLab documents caching separately from job artifacts. The useful question is not which mechanism is fastest, but which matches the dependency between your stages.
Name the expected result
For each job, describe what it receives and produces. Downloaded dependencies, a compiled binary and a test report serve different purposes.
Our recommendation is to start with the result consumed by deployment. The team should be able to identify its origin, associated commit and path from the producing job to the next one.
A directory left from a previous run does not prove it matches the code currently being built. Check that explicitly when runners share the workload.
Treat cache as an optimisation
A job should be able to rebuild what it needs when cache is absent. If missing cache makes delivery impossible, consider whether an essential result is stored in the wrong place.
The cache key should reflect what makes its contents compatible. A dependency or platform change can make an old copy unsuitable even when it remains available.
Avoid retaining secrets or personal files in a broad cache too. Accelerating an operation does not justify unnecessarily widening its data exposure.
Assign artifact lifetime and ownership
A result intended for another stage needs a clear origin. Decide who produces it, who consumes it and how long it must remain available.
Retention should not be chosen only to reduce disk usage. It must support actual uses: diagnosis, retry or delivery. Too short a lifetime can turn a minor incident into a complete rebuild.
For test outputs, do not mistake the presence of a file for a successful check. Job status and report contents should remain consistent.
Test without historical convenience
Run a test workflow without useful cache and verify transfers between jobs. That approximates a new runner or a machine that has just been cleaned.
If the result depends on an undeclared directory, document and correct that dependency. Do not hide it by asking people to retry until the right runner happens to be selected.
A robust pipeline uses cache when available without treating it as the only proof a deliverable exists. That separation improves reproducibility and the ability to explain failures.
Repeat the test after changes to runner layout or dependency installation. A previously reliable cache strategy may no longer describe the infrastructure that executes your jobs.
Cover visual: generated editorial illustration, not an official screenshot.




Join the discussion
Comments
Loading comments…