[CI] Upgrade to Bazel 8 (#38254)

Bazel 8 was released in Dec 2024 and gRPC picks this up as gRPC is expected to support the latest Bazel version. This upgrade needs many necessary changes to deal with its breaking changes. Those changes were made in separate PRs so that this very change stays small and simple. In addition to obvious mechanical changes, a noteworthy change is made; adding `common --enable_workspace=true` to the `bazel.rc` file. This re-enables workspace functionality, which was disabled by default in Bazel 8. This is a temporary measure and will be removed once gRPC completes its migration to bzlmod later this year.

All comments below are working logs that I've made and don't need to be read for the code review.

Closes #38254

PiperOrigin-RevId: 718488476
This commit is contained in:
Esun Kim
2025-01-22 12:38:17 -08:00
committed by Copybara-Service
parent 13e571a285
commit 155e8b8898
16 changed files with 27 additions and 10 deletions

View File

@@ -1 +1 @@
7.4.1
8.0.1

View File

@@ -1 +1,2 @@
8.0.1
7.4.1

View File

@@ -60,6 +60,9 @@ function upload {
upload github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-linux-x86_64
upload github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-darwin-x86_64
upload github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-windows-x86_64.exe
upload github.com/bazelbuild/bazel/releases/download/8.0.1/bazel-8.0.1-linux-x86_64
upload github.com/bazelbuild/bazel/releases/download/8.0.1/bazel-8.0.1-darwin-x86_64
upload github.com/bazelbuild/bazel/releases/download/8.0.1/bazel-8.0.1-windows-x86_64.exe
# Collect the github archives to mirror from grpc_deps.bzl
grep -o '"https://github.com/[^"]*"' bazel/grpc_deps.bzl | sed 's/^"https:\/\///' | sed 's/"$//' | while read -r line ; do

View File

@@ -43,6 +43,7 @@ However individual releases may have a broader
compatibility range. The currently supported versions are captured by the
following list:
- [`8.0.1`](https://github.com/bazelbuild/bazel/releases/tag/8.0.1)
- [`7.4.1`](https://github.com/bazelbuild/bazel/releases/tag/7.4.1)
NOTE: gRPC doesn't support bzlmod yet.

View File

@@ -3,6 +3,7 @@
# Bazel 7 begins to enable module by default which breaks gRPC build.
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
common --enable_workspace=true
build --cxxopt='-std=c++17'
build --host_cxxopt='-std=c++17'

View File

@@ -3,6 +3,7 @@
# Bazel 7 begins to enable module by default which breaks gRPC build.
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
common --enable_workspace=true
build --cxxopt='-std=c++17'
build --host_cxxopt='-std=c++17'

View File

@@ -3,6 +3,7 @@
# Bazel 7 begins to enable module by default which breaks gRPC build.
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
common --enable_workspace=true
build --cxxopt='-std=c++17'
build --host_cxxopt='-std=c++17'

View File

@@ -4,6 +4,14 @@
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
# gRPC build will break under Bazel 8 because Bazel 8 disables workspace by default.
# To prevent this, we've enabled workspace again until gRPC fully transitions to Bzlmod.
common --enable_workspace=true
# Bazel 8 needs this
common --incompatible_disallow_empty_glob=false
common --incompatible_disallow_struct_provider_syntax=false
# for platform-appropriate cxxopts
common --enable_platform_specific_config

View File

@@ -88,8 +88,8 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/interoptest/grpc_interop_ruby.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby@sha256:ce9539e9068b2597d5d43dc2bb7df17b84fd8192759cf7a02132b676ca6fa4ed",
"tools/dockerfile/interoptest/lb_interop_fake_servers.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/lb_interop_fake_servers@sha256:b89a51dd9147e1293f50ee64dd719fce5929ca7894d3770a3d80dbdecb99fd52",
"tools/dockerfile/test/android_ndk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/android_ndk@sha256:e4fd2e0048c4ffd2a04e4a41154ee469ed61e058cb704ee95071f7a3bdad507a",
"tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:a0ca2c4f113c4d9e62e67b36d1734c0ffc3baff851cc48f23616df82484f905d",
"tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:2728d010d87cb1845d002efbc3d08dadc283e8d0b7e0b582c2623960af61d2c5",
"tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:2677aecec57bb89bc0c7a409151507187343ba8272bdafc3e42d451f5841bd57",
"tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:14157b9987b3da1a29cab71124f566c04342490f3764f52c64cb65c0158223ad",
"tools/dockerfile/test/csharp_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_debian11_arm64@sha256:4d4bc5f15e03f3d3d8fd889670ecde2c66a2e4d2dd9db80733c05c1d90c8a248",
"tools/dockerfile/test/csharp_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_debian11_x64@sha256:0763d919b17b4cfe5b65aff3bf911c04e9e4d46d11649858742033facd9f534f",
"tools/dockerfile/test/cxx_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/cxx_alpine_x64@sha256:f49643b001fde1559e1607fa2735230c0a2acf97fb854e3bd56fb9e1c419883d",
@@ -112,5 +112,5 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:b3eb1a17b7b091e3c5648a803076b2c40601242ff91c04d55997af6641305f68",
"tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:d2e79919b2e2d4cc36a29682ecb5170641df4fb506cfb453978ffdeb8a841bd9",
"tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:6e8b4696ba0661f11a31ed0992a94d2efcd889a018f57160f0e2fb62963f3593",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:8b8e0b83725dfc5f81c901b3a737872410ee04fc1cb8b9ec5b2e4a5670fbf23c",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:998a0ec246abde100bd0f295cf2d1945e381a7f53d3309f94dcadf73295fdeb9",
}

View File

@@ -17,5 +17,6 @@ This file is generated from the supported_bazel_versions.bzl.template
"""
SUPPORTED_BAZEL_VERSIONS = [
"8.0.1",
"7.4.1",
]

View File

@@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:f807574dd98dfb4a31da1104bfcb7de444b98797@sha256:a0ca2c4f113c4d9e62e67b36d1734c0ffc3baff851cc48f23616df82484f905d
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:7e7df73e8973de9ef2c75d2c633e7c43b581c1cd@sha256:2677aecec57bb89bc0c7a409151507187343ba8272bdafc3e42d451f5841bd57

View File

@@ -38,7 +38,7 @@ RUN apt-get update && apt-get -y install \
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 7.4.1
ENV BAZEL_VERSION 8.0.1
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

View File

@@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:6abcf8ebfbfdde00a629dcd6e0743ed0de578387@sha256:2728d010d87cb1845d002efbc3d08dadc283e8d0b7e0b582c2623960af61d2c5
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:90f06fd599c2136da3e6655b07b75124e26e18b5@sha256:14157b9987b3da1a29cab71124f566c04342490f3764f52c64cb65c0158223ad

View File

@@ -97,7 +97,7 @@ RUN apt-get update && apt-get -y install libc++-dev clang && apt-get clean
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 7.4.1
ENV BAZEL_VERSION 8.0.1
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

View File

@@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:031ef1568c1e7c3347429dbcb3ea5534812515c4@sha256:8b8e0b83725dfc5f81c901b3a737872410ee04fc1cb8b9ec5b2e4a5670fbf23c
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:5c970669936e0ad2e3ef89216acf3987c746f3b1@sha256:998a0ec246abde100bd0f295cf2d1945e381a7f53d3309f94dcadf73295fdeb9

View File

@@ -108,7 +108,7 @@ RUN apt-get update && apt-get install -y jq git && apt-get clean
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 7.4.1
ENV BAZEL_VERSION 8.0.1
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1