From 4211d07e7d1baa1750835014712636c2987ea728 Mon Sep 17 00:00:00 2001 From: Anton Krivoborodov Date: Thu, 24 Sep 2026 10:40:05 +0000 Subject: [PATCH] ci: rotate bazel cache keys on module bumps setup-bazel derives the cache key hash for both the repository cache and the disk cache from the `repository-cache` file list -- config.js spreads repositoryCacheFiles into diskCache.files, which the README does not mention. The default list covers only MODULE.bazel and WORKSPACE*, and neither changes when a module is bumped in known_good.json or in bazel_common/*.MODULE.bazel. So the key never rotated. post.js returns early when the restored key matches exactly, which means that after the very first save no run ever wrote a cache again: the disk cache kept serving the results of whatever module states happened to be current when it was created, and the repository cache rotated three times in three months while module states changed twenty times. Nothing ever failed, because Bazel addresses its entries by action key -- stale entries are simply never hit. List the files that actually invalidate action keys or the set of fetched module sources. Saving stays gated on push-to-main, so only the merge run pays the additional upload; measured against the existing repository cache that is roughly 90 seconds for 3.3 GB. --- .github/workflows/test_and_docs.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_and_docs.yml b/.github/workflows/test_and_docs.yml index 0e8a9e49c40..1cf61490e1a 100644 --- a/.github/workflows/test_and_docs.yml +++ b/.github/workflows/test_and_docs.yml @@ -57,7 +57,20 @@ jobs: with: bazelisk-cache: true disk-cache: ${{ github.workflow }} - repository-cache: true + # This list feeds the cache key hash of BOTH the repository cache and + # the disk cache (see config.js: diskCache.files spreads + # repositoryCacheFiles). The default is MODULE.bazel + WORKSPACE* only, + # which never changes when we bump a module - so the key never rotates, + # and setup-bazel skips the save on an exact key hit. Result: both + # caches freeze on their first entry and go stale without ever failing. + # Keep this list in sync with anything that invalidates Bazel action + # keys or the set of fetched module sources. + repository-cache: | + - MODULE.bazel + - known_good.json + - bazel_common/*.MODULE.bazel + - patches/** + - .bazelrc cache-save: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - name: Set up Python 3 uses: actions/setup-python@v5