Skip to content

ci: fix goreleaser build cache misses on release#2915

Merged
matiasinsaurralde merged 1 commit into
chainloop-dev:mainfrom
matiasinsaurralde:ci/fix-goreleaser-go-build-cache
Mar 22, 2026
Merged

ci: fix goreleaser build cache misses on release#2915
matiasinsaurralde merged 1 commit into
chainloop-dev:mainfrom
matiasinsaurralde:ci/fix-goreleaser-go-build-cache

Conversation

@matiasinsaurralde

Copy link
Copy Markdown
Contributor

Summary

The release job was doing a full recompile of all binaries on every run despite actions/setup-go reporting a cache hit. The root cause: CGO_ENABLED=0 was only set inside .goreleaser.yml, not at the job level, so the build cache was saved and restored with CGO_ENABLED=1 (the Linux default). Goreleaser then built with CGO_ENABLED=0, producing different build cache keys for every package in the tree.

Setting CGO_ENABLED=0 at the job level aligns the cache key with what goreleaser uses. On warm cache runs, only packages whose source actually changed will recompile.

actions/setup-go saves and restores the build cache keyed with the
active environment. Without CGO_ENABLED=0 set at the job level, the
cache is saved with CGO_ENABLED=1 (Linux default), but goreleaser
builds with CGO_ENABLED=0, causing a full recompile of all packages
on every release run despite a reported cache hit.

Signed-off-by: Matías Insaurralde <matias@chainloop.dev>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@matiasinsaurralde matiasinsaurralde requested a review from a team March 22, 2026 04:35
@matiasinsaurralde matiasinsaurralde merged commit b16ba0e into chainloop-dev:main Mar 22, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants