From 3961c0a8dc7ce323aa344d8bf7c2533356196c8b Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Sun, 8 Nov 2026 23:12:46 -0800 Subject: [PATCH 1/2] ci(bazel): isolate dependency snapshots and verify complete warms --- .github/actions/setup-bazel/action.yml | 48 +++++++++++++++++---- .github/actions/setup-bazel/save/action.yml | 4 +- .github/workflows/dependency-cache.yml | 16 ++++++- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup-bazel/action.yml b/.github/actions/setup-bazel/action.yml index a54ef3b921..4d7e8cf73f 100644 --- a/.github/actions/setup-bazel/action.yml +++ b/.github/actions/setup-bazel/action.yml @@ -25,6 +25,9 @@ inputs: cache-save: description: Whether master jobs may save Bazelisk and newly fetched dependencies. default: "true" + verify-launcher-cache: + description: Restore only the complete launcher cache for an offline verification. + default: "false" windows-redirect-temp: description: Put Windows test temporary files on the runner workspace drive. default: "false" @@ -52,6 +55,12 @@ outputs: repository-cache-entries: description: Restored entry count, used to avoid uploading an unchanged cache. value: ${{ steps.repository-cache-state.outputs.entries }} + launcher-cache-key: + description: Immutable platform and manifest key for a complete launcher archive. + value: ${{ steps.launcher-cache.outputs.cache-primary-key }} + launcher-cache-hit: + description: Whether the exact complete launcher archive was restored. + value: ${{ steps.launcher-cache.outputs.cache-hit }} runs: using: composite @@ -142,6 +151,10 @@ runs: shell: bash env: CACHE_NAME: ${{ inputs.cache-key }} + WORKFLOW_NAME: ${{ github.workflow }} + JOB_NAME: ${{ github.job }} + MANIFEST: ${{ hashFiles('MODULE.bazel', 'Cargo.lock', 'pnpm-lock.yaml', '.bazelversion') }} + LAUNCHER_MANIFEST: ${{ hashFiles('MODULE.bazel', 'Cargo.lock', 'pnpm-lock.yaml', '.bazelversion', '.bazelrc', 'scripts/bazel/downloader.cfg', '.github/workflows/dependency-cache.yml') }} EXTRA_RESTORE_KEYS: ${{ inputs.extra-restore-keys }} run: | node <<'JS' @@ -156,7 +169,11 @@ runs: const repositoryPath = windowsRoot ? `${windowsRoot}b-repo` : `${os.homedir().replace(/\\/g, '/')}/.cache/bazel-repo`; - const repositoryPrefix = `setup-bazel-1-${process.platform}-${os.arch()}-repository-`; + const platform = `setup-bazel-1-${process.platform}-${os.arch()}`; + const { WORKFLOW_NAME, JOB_NAME, CACHE_NAME, MANIFEST } = process.env; + const workload = `${platform}-deps-${WORKFLOW_NAME}-${JOB_NAME}-${CACHE_NAME}-`; + const legacy = `${platform}-repository-`; + const launcher = `${platform}-launcher-helpers-${process.env.LAUNCHER_MANIFEST}`; const names = [process.env.CACHE_NAME, ...(process.env.EXTRA_RESTORE_KEYS || '') .split(',') .map((name) => name.trim()) @@ -165,7 +182,7 @@ runs: `setup-bazel-1-${process.platform}-${os.arch()}-disk-${name}-`); fs.appendFileSync( process.env.GITHUB_OUTPUT, - `repository-path=${repositoryPath}\nrepository-prefix=${repositoryPrefix}\npath=${path}\noutput-base=${windowsRoot ? `${windowsRoot}b` : ''}\nprefix=${prefixes[0]}\nrestore-keys< Date: Sun, 8 Nov 2026 23:16:33 -0800 Subject: [PATCH 2/2] fix(ci): prevent cross-workload dependency restore fallbacks --- .github/actions/setup-bazel/action.yml | 26 ++++++++++++++++---------- .github/workflows/dependency-cache.yml | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-bazel/action.yml b/.github/actions/setup-bazel/action.yml index 4d7e8cf73f..3b55bd4a1d 100644 --- a/.github/actions/setup-bazel/action.yml +++ b/.github/actions/setup-bazel/action.yml @@ -171,8 +171,8 @@ runs: : `${os.homedir().replace(/\\/g, '/')}/.cache/bazel-repo`; const platform = `setup-bazel-1-${process.platform}-${os.arch()}`; const { WORKFLOW_NAME, JOB_NAME, CACHE_NAME, MANIFEST } = process.env; - const workload = `${platform}-deps-${WORKFLOW_NAME}-${JOB_NAME}-${CACHE_NAME}-`; - const legacy = `${platform}-repository-`; + const identity = [WORKFLOW_NAME, JOB_NAME, CACHE_NAME].map(encodeURIComponent).join(':'); + const workload = `${platform}-deps:${identity}:`; const launcher = `${platform}-launcher-helpers-${process.env.LAUNCHER_MANIFEST}`; const names = [process.env.CACHE_NAME, ...(process.env.EXTRA_RESTORE_KEYS || '') .split(',') @@ -180,10 +180,19 @@ runs: .filter(Boolean)]; const prefixes = names.map((name) => `setup-bazel-1-${process.platform}-${os.arch()}-disk-${name}-`); - fs.appendFileSync( - process.env.GITHUB_OUTPUT, - `repository-path=${repositoryPath}\nworkload=${workload}\nworkload-manifest=${workload}${MANIFEST}-\nlegacy-manifest=${legacy}${MANIFEST}\nlegacy=${legacy}\nlauncher=${launcher}\npath=${path}\noutput-base=${windowsRoot ? `${windowsRoot}b` : ''}\nprefix=${prefixes[0]}\nrestore-keys<