Repository navigation
ci: only save caches from main - #4051
Conversation
PR and merge queue entries are only visible to their own ref, and evict main's under the 10GB repo limit. verify gets its own cache for the tools it builds and golangci-lint results. Signed-off-by: Benjamin Elder <bentheelder@google.com>
Max Smythe (maxsmythe)
left a comment
There was a problem hiding this comment.
AI found some questions :)
| ~/.cache/go-build | ||
| ~/.cache/golangci-lint | ||
| ~/go/pkg/mod | ||
| key: verify-go-${{ runner.os }}-${{ hashFiles('**/go.sum') }} |
There was a problem hiding this comment.
🤖 should-fix 🟡 – Go deletes build cache entries whose mtime is more than 5 days old, and this cache is only written by a main run with a new go.sum. go.sum often goes longer than that without changing. After that, the first go command in each run trims most of the restored ~/.cache/go-build, and verify rebuilds its tools. Keying on the commit like unit-go and e2e-go avoids it.
There was a problem hiding this comment.
fixed, keyed on the commit now
| sudo apt-get install -y -qq --no-install-recommends clang libclang-dev | ||
| hack/test-dynamic-modules.sh | ||
| - name: Save cargo cache | ||
| if: ${{ !cancelled() && github.ref == 'refs/heads/main' && steps.cargo-cache.outputs.cache-hit != 'true' }} |
There was a problem hiding this comment.
🤖 should-fix 🟡 – !cancelled() saves after dynamic module tests fails. This key is written once per Cargo.lock, so a partial target stays until the lockfile changes again. The step also runs when an earlier step fails and the restore is skipped, and then it errors on the empty key. Dropping !cancelled() matches what actions/cache did. The verify save below pins a failed run's cache the same way.
There was a problem hiding this comment.
fixed, the cargo save only runs on success now
| path: | | ||
| ~/.cache/go-build | ||
| ~/go/pkg/mod | ||
| key: unit-go-${{ runner.os }}-${{ github.sha }} |
There was a problem hiding this comment.
🤖 question 🟢 – On main today the setup-go cache is about 3GB and each e2e-go cache about 2.4GB, so every main commit will write over half the 10GB limit. Does that leave enough room for verify-go, cargo and the microVM assets to survive eviction between commits?
There was a problem hiding this comment.
eviction is by last access, and verify-go, cargo and the microVM assets are restored on every PR run, so the previous commit's unit-go / e2e-go / verify-go go first. the risk is one commit's caches getting near 10GB, we'll see the real sizes once main saves them (no super great way to do this before merge)
There was a problem hiding this comment.
now that main has saved them: unit-go is 1.4GB, verify-go 1.7GB and e2e-go 1.7GB, so ~4.8GB per commit plus ~1GB of codeql. we're at 9.4GB, cargo and the microVM assets survived, and the old 3GB setup-go entry was evicted.
go trims build cache entries unused for 5 days, and a cache keyed on go.sum often outlives that. the cargo save also ran after an earlier step failed and skipped the restore, with an empty key. Signed-off-by: Benjamin Elder <bentheelder@google.com>
Part of #3721. Follows #3722.
PR and merge queue runs could save caches, but those entries are only visible to their own ref, and the repo is at the 10GB cache limit, so they evict main's. Now only main saves, and everything else restores main's.
AI use: AI drafted the change. I reviewed it.