Loading
fix(ci): make .go-build-cache actually cache Go artifacts
(Kudos to @kkloss's lovely pipeline visualizer for sending me down this rabbit hole)
Previously, the .go-build-cache job pointed GOMODCACHEGOCACHE at paths outside $CI_PROJECT_DIR, which the runner silently skips, so every Go job ran cold.
This MR relocates both caches into $CI_PROJECT_DIR and splits them:
- Modules: one shared, read-only cache seeded by a warm-go-mod-cache job (new prepare stage) so consumers can't overwrite the complete set with a partial one.
- Compiled objects: per-job cache keyed on
$CI_JOB_NAME_SLUG, since output is specific to build tags, Go version, and -race.
Pre-these changes:
- Example pipeline
- 5-7 minutes per pipeline.
- Test and build jobs running between 3-5 minutes
- Every job re-downloads full set of dependencies
- No cache usage
After these changes:
- Warm example pipeline
- ~2 minutes per pipeline.
- Tests and build jobs <1 minute
- All jobs use cached module dependencies (seeded if invalidated as an initial job)
- Build artifacts cached by job name (Archive files)
Edited by Luke Hollinda