Add authenticated GCS caching for Bazel CI and releases (#61187)

## What changed

- Authenticate eligible protected `main` runs and Rust release tags with GitHub OIDC. Allow cache uploads only on `main` pushes; use read-only access for manual runs and release tags, and leave pull requests without GCS credentials.
- Rename the shared wrapper to `.github/scripts/run_bazel.py` and route Bazel callers through it. Disable the disk cache in GitHub Actions and default macOS GCS connections to 20 while respecting explicit limits.
- Gate additional Bazel release artifacts on `CODEX_BAZEL_RELEASES` and cache configuration, sharing the selected build systems across building, signing, and packaging. Keep Cargo as the default and prepare native Windows dependencies for Bazel releases.
- Add a `Bazel result` check for the full workflow and extend Bazel job timeouts.

## Testing

Add wrapper tests for cache access by event, argument preservation, and macOS connection limits. The wrapper test suite passes.

GitOrigin-RevId: d85edbd083acfaa8bafaa8fd5241daed3e9ef871
This commit is contained in:
Dmitriy Kovalenko
2026-11-12 21:41:05 +00:00
committed by copyberry
parent d0221bc947
commit 4490060db6
25 changed files with 464 additions and 184 deletions
+20 -2
View File
@@ -11,10 +11,24 @@ jobs:
# Keep reusable workflow calls alphabetized. The `required` job below is the
# version-controlled list that the main-branch ruleset should require.
bazel:
permissions:
contents: read
id-token: write
name: Bazel
uses: ./.github/workflows/bazel.yml
secrets: inherit
bazel-result:
name: Bazel result
needs: bazel
if: ${{ always() }}
runs-on: ubuntu-24.04
steps:
- name: Require the Bazel workflow to succeed
env:
BAZEL_RESULT: ${{ needs.bazel.result }}
run: test "$BAZEL_RESULT" = success
blob-size-policy:
name: Blob size policy
uses: ./.github/workflows/blob-size-policy.yml
@@ -36,11 +50,17 @@ jobs:
secrets: inherit
rust-ci:
permissions:
contents: read
id-token: write
name: rust-ci
uses: ./.github/workflows/rust-ci.yml
secrets: inherit
sdk:
permissions:
contents: read
id-token: write
name: sdk
uses: ./.github/workflows/sdk.yml
secrets: inherit
@@ -50,8 +70,6 @@ jobs:
# Without `always()`, GitHub skips this job after a failed dependency and a
# required check can appear successful instead of reporting the failure.
if: ${{ always() }}
# Bazel is advisory while the BuildBuddy key is revoked. Restore its dependency
# once the suite can run without BuildBuddy.
needs:
- blob-size-policy
- cargo-deny