From 16acf7ed86f5fcc2f2b68b108b397412121bb6c6 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 17 Apr 2024 20:15:19 -0700 Subject: [PATCH] Fix bazel cache issues in 7.0.0 We're seeing a high flake rate due to remote cache-misses only on Bazel 7 builds. The key change here seems to be adding the remote_download_output flag, but this also upgrades us to 7.1.1 and adds some retry behavior to caching issues. PiperOrigin-RevId: 625892332 --- .github/workflows/test_cpp.yml | 6 +++--- .github/workflows/test_rust.yml | 2 +- .github/workflows/test_upb.yml | 4 ++-- ci/common.bazelrc | 5 +++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index b18bc344af..772402f1c7 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -31,7 +31,7 @@ jobs: # Override cases with custom images - config: { name: "Bazel7" } - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.1-75f2a85ece6526cc3d54087018c0f1097d78d42b" targets: "//src/... //third_party/utf8_range/..." - config: { name: "TCMalloc" } image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:bd39119d74b8a3fad4ae335d4cf5294e70384676331b7e19949459fc7a8d8328" @@ -328,7 +328,7 @@ jobs: os: macos-12 cache_key: macos-12-bazel7 bazel: test //src/... //third_party/utf8_range/... - bazel_version: '7.0.0' + bazel_version: '7.1.1' - name: MacOS Apple Silicon (build only) Bazel os: macos-12 cache_key: macos-12-arm @@ -343,7 +343,7 @@ jobs: os: windows-2022 cache_key: windows-2022-bazel7 bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - bazel_version: '7.0.0' + bazel_version: '7.1.1' name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index a82ff2c434..6018eec953 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -23,7 +23,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.1-75f2a85ece6526cc3d54087018c0f1097d78d42b" credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: rust_linux bazel: >- diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index 3c257356fc..6f9f25c6a9 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: config: - - { name: "Bazel 7", bazel_version: "7.0.0" } + - { name: "Bazel 7", bazel_version: "7.1.1" } - { name: "Fastbuild" } - { name: "Optimized", flags: "-c opt" } - { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/...", runner: ubuntu-20-large } @@ -37,7 +37,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.3.0' }}-d07b7d649401d147e71e7182d2832cc8344f1f35 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.3.0' }}-75f2a85ece6526cc3d54087018c0f1097d78d42b credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //protos/... //protos_generator/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }} diff --git a/ci/common.bazelrc b/ci/common.bazelrc index f8100e8480..b0501d5d20 100644 --- a/ci/common.bazelrc +++ b/ci/common.bazelrc @@ -28,6 +28,11 @@ build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 # https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748 build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr +# Workaround Bazel 7 remote cache issues. +# See https://github.com/bazelbuild/bazel/issues/20161 +build --experimental_remote_cache_eviction_retries=5 +build --remote_download_outputs=all + # Build with all --incompatible flags that we can. This helps us prepare for # upcoming breaking changes in Bazel. This list was generated for Bazel 6 by # running bazelisk with the --migrate flag and filtering out all flags that