Repository navigation
TT-18683: Prune the Go build cache before saving it (tyk-analytics master only) - #576
Open
rafalgolarz wants to merge 6 commits into
Open
rafalgolarz wants to merge 6 commits into
rafalgolarz wants to merge 6 commits into
Conversation
rafalgolarz
marked this pull request as ready for review
October 25, 2026 07:27
olamilekan000
approved these changes
Oct 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TT-18683: Prune the Go build cache before saving it (tyk-analytics master only)
Changes
Adds an opt-in feature
go-cache-pruneto the generated release.yml and enables it only for tyk-analyticsmaster(config/config.yaml). Every other repo and branch renders exactly the same release.yml as before; the only changed golden snapshot istyk-analytics/master/.github/workflows/release.yml(3 files in the PR).With the feature on, a new step runs before "Save Go build cache": it deletes files in
~/.cache/go-buildthat were untouched for 2+ days (Go bumps the mtime of entries it uses) and logsdu -shbefore and after. It runs only off-PR and only when a save will actually happen (cache-hit != 'true'). The build container writes as root, so it usessudowhen the runner user is not root. The module cache (~/go/pkg/mod) is not pruned: Go does not bump its mtimes, so age says nothing about use.Why: a partial restore (restore-keys) is saved under a new key on every go.sum change, so the cache only grows (60.9 GB / 153k files in the master entry).
Measured (tyk-analytics, job
1.26-bullseye, 8x runner)The pruned cache was seeded once from the master cache; then the same job was re-run on the same commit, alternating between the unpruned master cache (control) and the pruned one. n = 4 per arm, no invalid runs.
config(real rebuild), run 40118194165The pruned cache is 31.2 GB / 66k files. Build did not get slower in either rebuild scenario.
What this does not show
cache-hit != 'true'.Risks
sudoworked on the 8x runner in the experiments.After merging: how to decide whether to keep going
release.ymlwhere the save happens: the step "Save Go build cache" runs (it is skipped on an exact cache hit). Master updates from bot go.mod commits usually trigger it.1.26-bullseye:before:/after:sizes (expect the cache to drop from ~60 GB to ~30 GB);Cache saved with key: ...); note its duration.gh api repos/TykTechnologies/tyk-analytics/actions/runs/<id>/jobsstep durations):go-cache-pruneto their branches inconfig/config.yaml, one repo at a time);config/config.yaml, merge the resulting sync PR in tyk-analytics. That is the whole rollback.Related
cache-to) on PR builds, tyk-analytics only (image push steps ~98 s shorter in an experiment, n = 5). Both PRs change the tyk-analytics master snapshot: after one is merged, rebase the other and runmake update-golden.Refs: TT-18683
Ticket Details
TT-18683
Generated at: 2026-10-28 22:00:14