[bazel] Upgrade bazel repo-wide to 6.3.2 (#34088)

- Upgrade bazel
- Reduce the number of places where bazel version needs to be upgraded
in future.
- also make sure the list of bazel versions to test by bazelified tests
is loaded from supported_versions.txt (it was hardcoded before).
- ~~Try upgrading windows RBE build to bazel 6.3.2 as well.~~

The core idea:
- the source of truth for supported bazel versions is in
`bazel/supported_versions.txt`
- the first version listed in `bazel/supported_versions.txt` is
considered to be the "primary" bazel version and is going to be used in
most places thoroughout the repo.
- use templates to include the primary bazel version in testing
dockerfiles and in a newly introduced `.bazelversion` files (which gets
loaded by our existing `tools/bazel` wrapper).


~~Supersedes https://github.com/grpc/grpc/pull/33880~~
pull/34105/head
Jan Tattermusch 1 year ago committed by GitHub
parent 3b4b69a509
commit d3548a3941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .bazelversion
  2. 2
      bazel/supported_versions.txt
  3. 4
      bazel/update_mirror.sh
  4. 2
      doc/bazel_support.md
  5. 4
      templates/.bazelversion.template
  6. 25
      templates/tools/bazelify_tests/test/supported_bazel_versions.bzl.template
  7. 2
      templates/tools/dockerfile/bazel.include
  8. 4
      templates/tools/dockerfile/oss_fuzz_base.include
  9. 7
      tools/bazel
  10. 8
      tools/bazelify_tests/dockerimage_current_versions.bzl
  11. 29
      tools/bazelify_tests/test/BUILD
  12. 44
      tools/bazelify_tests/test/bazel_distribtests.bzl
  13. 22
      tools/bazelify_tests/test/supported_bazel_versions.bzl
  14. 6
      tools/buildgen/plugins/supported_bazel_versions.py
  15. 2
      tools/dockerfile/test/bazel.current_version
  16. 6
      tools/dockerfile/test/bazel/Dockerfile
  17. 2
      tools/dockerfile/test/bazel_arm64.current_version
  18. 2
      tools/dockerfile/test/bazel_arm64/Dockerfile
  19. 2
      tools/dockerfile/test/binder_transport_apk.current_version
  20. 6
      tools/dockerfile/test/binder_transport_apk/Dockerfile
  21. 2
      tools/dockerfile/test/sanity.current_version
  22. 2
      tools/dockerfile/test/sanity/Dockerfile

@ -0,0 +1 @@
6.3.2

@ -1,2 +1,2 @@
6.1.2
6.3.2
5.4.1

@ -65,6 +65,10 @@ upload github.com/bazelbuild/bazel/releases/download/6.1.2/bazel-6.1.2-linux-x86
upload github.com/bazelbuild/bazel/releases/download/6.1.2/bazel-6.1.2-darwin-x86_64
upload github.com/bazelbuild/bazel/releases/download/6.1.2/bazel-6.1.2-windows-x86_64.exe
upload github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-x86_64
upload github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-darwin-x86_64
upload github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-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
echo "Updating mirror for ${line}"

@ -39,5 +39,5 @@ recent LTS versions of Bazel. However individual releases may have a broader
compatibility range. The currently supported versions are captured by the
following list:
- [`6.1.2`](https://github.com/bazelbuild/bazel/releases/tag/6.1.2)
- [`6.3.2`](https://github.com/bazelbuild/bazel/releases/tag/6.3.2)
- [`5.4.1`](https://github.com/bazelbuild/bazel/releases/tag/5.4.1)

@ -0,0 +1,4 @@
%YAML 1.2
--- |
${primary_bazel_version}

@ -0,0 +1,25 @@
%YAML 1.2
--- |
# Copyright 2023 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This file is generated from the supported_bazel_versions.bzl.template
"""
SUPPORTED_BAZEL_VERSIONS = [
% for ver in supported_bazel_versions:
"${ver}",
% endfor
]

@ -2,7 +2,7 @@
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 6.1.2
ENV BAZEL_VERSION ${primary_bazel_version}
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

@ -1,8 +1,8 @@
# Pinned version of the base image is used to avoid regressions caused
# by rebuilding of this docker image. To see available versions, you can run
# "gcloud container images list-tags gcr.io/oss-fuzz-base/base-builder"
# Image(a4ad7a70fe10) is built on Apr 19, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:a4ad7a70fe10674c880ca8618a564860114a31dcdd6f9896aac89f0b2f86112a
# Image(fd89316ac4c5) is built on Aug 17, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:fd89316ac4c5f3e25802ca95a00062cece14f0602c5512d71ffeedc22734c0b9
# -------------------------- WARNING --------------------------------------
# If you are making changes to this file, consider changing

@ -40,9 +40,10 @@ then
fi
fi
# IMPORTANT: if you update the version here, other parts of infrastructure might needs updating as well
# (e.g. sanity checks, bazel toolchains etc.)
VERSION=${OVERRIDE_BAZEL_VERSION:-6.1.2}
# Read the bazel version from .bazelversion file in the root of the grpc repository
BAZELVERSION_FILE_PATH="$(dirname $(readlink -f "$0"))/../.bazelversion"
VERSION_FROM_BAZELVERSION_FILE=$(cat ${BAZELVERSION_FILE_PATH})
VERSION=${OVERRIDE_BAZEL_VERSION:-${VERSION_FROM_BAZELVERSION_FILE}}
echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." >&2
# update tools/update_mirror.sh to populate the mirror with new bazel archives

@ -90,9 +90,9 @@ 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:7b044d6848f82234dba81b38d8eca220b608f830f93b42932df59ed6fe20b24d",
"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:bd97f626950e06b0e9ccc790d970e4ce377b5bd408e6ff93045e5e3b061980c9",
"tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:195836ff6ba52d2ae15c21d124d3b77d563b7aed0db47b05a746be71d36ab991",
"tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:47b550b6b6e2023a9bfd5be34e106cc4a58868153bd57e0597b9ab6399716324",
"tools/dockerfile/test/binder_transport_apk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk@sha256:85341f035e44601a93d16ff5b9b5810a0da313af03e2a76cf4135144633e0bab",
"tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:d3291d3129469bd4bdd58b5dd81eb6c5668548a4d6e6c8e952fb372d1874b078",
"tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:1b7200c85ba8bc10529e1867a27ee81ad303ec8c8efec8bbc5863b4ee8ac6d03",
"tools/dockerfile/test/binder_transport_apk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk@sha256:38c1da5544c717ef0e3d3492833b0fd1ce5c70fbe71eea8a9bfb0ab0b1217f1b",
"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:b2e5c47d986312ea0850e2f2e696b45d23ee0aabceea161d31e28559e19ec4a5",
"tools/dockerfile/test/cxx_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/cxx_alpine_x64@sha256:aa9aced0f18b669a2121e2177ce540a2e1610f95a5982535b62df0d2e8b22a06",
@ -113,5 +113,5 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:d3951aeadf43e3bee6adc5b86d26cdaf0b9d1b5baf790d7b2530d1c197adc9f8",
"tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:7e77cf17e2e8657f4cc23ac9f93630bf13213fff961799e0f16dae17cd45cf6d",
"tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:e4cb502caccf2db733268ce2ddc951fda8a9df2f7f53d6b74523c33d40c83006",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:585f55c6159b907a9326eaa9b7946a649724bacb2b92894c4167332a56c32b51",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:697961d9bc7e8b61598b707fade0b1a5d2e4e8c12e7ed66b07ab35eb619f0722",
}

@ -13,8 +13,9 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_package")
load("//tools/bazelify_tests:build_defs.bzl", "grpc_run_bazel_distribtest_test", "grpc_run_cpp_distribtest_test", "grpc_run_tests_harness_test")
load("//tools/bazelify_tests:build_defs.bzl", "grpc_run_cpp_distribtest_test", "grpc_run_tests_harness_test")
load(":portability_tests.bzl", "generate_run_tests_portability_tests")
load(":bazel_distribtests.bzl", "generate_bazel_distribtests")
licenses(["notice"])
@ -22,6 +23,8 @@ grpc_package(name = "tools/bazelify_tests/test")
generate_run_tests_portability_tests(name = "portability_tests_linux")
generate_bazel_distribtests(name = "bazel_distribtests_linux")
# C/C++
grpc_run_tests_harness_test(
name = "runtests_c_linux_dbg",
@ -210,30 +213,6 @@ test_suite(
],
)
# TODO(jtattermusch): load supported versions from //bazel/supported_versions.txt
grpc_run_bazel_distribtest_test(
name = "bazel_distribtest_5.4.1",
size = "enormous",
args = ["5.4.1"],
docker_image_version = "tools/dockerfile/test/bazel.current_version",
)
# TODO(jtattermusch): load supported versions from //bazel/supported_versions.txt
grpc_run_bazel_distribtest_test(
name = "bazel_distribtest_6.1.2",
size = "enormous",
args = ["6.1.2"],
docker_image_version = "tools/dockerfile/test/bazel.current_version",
)
test_suite(
name = "bazel_distribtests_linux",
tests = [
":bazel_distribtest_5.4.1",
":bazel_distribtest_6.1.2",
],
)
test_suite(
name = "all_tests_linux",
tests = [

@ -0,0 +1,44 @@
# Copyright 2023 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Generates portability tests.
"""
load("supported_bazel_versions.bzl", "SUPPORTED_BAZEL_VERSIONS")
load("//tools/bazelify_tests:build_defs.bzl", "grpc_run_bazel_distribtest_test")
def generate_bazel_distribtests(name):
"""Generates the bazel distribtests.
Args:
name: Name of the test suite that will be generated.
"""
test_names = []
for bazel_version in SUPPORTED_BAZEL_VERSIONS:
test_name = "bazel_distribtest_%s" % bazel_version
grpc_run_bazel_distribtest_test(
name = test_name,
size = "enormous",
args = [bazel_version],
docker_image_version = "tools/dockerfile/test/bazel.current_version",
)
test_names.append(test_name)
# Generate test suite that allows easily running all bazel distribtests.
native.test_suite(
name = name,
tests = [(":%s" % test_name) for test_name in test_names],
)

@ -0,0 +1,22 @@
# Copyright 2023 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This file is generated from the supported_bazel_versions.bzl.template
"""
SUPPORTED_BAZEL_VERSIONS = [
"6.3.2",
"5.4.1",
]

@ -25,4 +25,8 @@ def _get_supported_bazel_versions():
def mako_plugin(dictionary):
dictionary["supported_bazel_versions"] = _get_supported_bazel_versions()
versions = _get_supported_bazel_versions()
dictionary["supported_bazel_versions"] = versions
# The entry listed in the "supported_version.txt" file is considered
# to be our repo-wide bazel version.
dictionary["primary_bazel_version"] = versions[0]

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:212a7a3cf9ccb4f5eedb71128ff027b76448c2b6@sha256:195836ff6ba52d2ae15c21d124d3b77d563b7aed0db47b05a746be71d36ab991
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:d64f53cefe4fe5908e00130a7a0dbe6253d9f0b8@sha256:d3291d3129469bd4bdd58b5dd81eb6c5668548a4d6e6c8e952fb372d1874b078

@ -15,8 +15,8 @@
# Pinned version of the base image is used to avoid regressions caused
# by rebuilding of this docker image. To see available versions, you can run
# "gcloud container images list-tags gcr.io/oss-fuzz-base/base-builder"
# Image(a4ad7a70fe10) is built on Apr 19, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:a4ad7a70fe10674c880ca8618a564860114a31dcdd6f9896aac89f0b2f86112a
# Image(fd89316ac4c5) is built on Aug 17, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:fd89316ac4c5f3e25802ca95a00062cece14f0602c5512d71ffeedc22734c0b9
# -------------------------- WARNING --------------------------------------
# If you are making changes to this file, consider changing
@ -38,7 +38,7 @@ RUN apt-get update && apt-get -y install \
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 6.1.2
ENV BAZEL_VERSION 6.3.2
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:179a2f78ca85195a24391409276f19a2373876cf@sha256:47b550b6b6e2023a9bfd5be34e106cc4a58868153bd57e0597b9ab6399716324
us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:b80154c9d14839d4e387155401c5204f2cc09262@sha256:1b7200c85ba8bc10529e1867a27ee81ad303ec8c8efec8bbc5863b4ee8ac6d03

@ -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 6.1.2
ENV BAZEL_VERSION 6.3.2
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk:6f6d33e740ced89b744c2d8bdf0e9c4744cc1c52@sha256:85341f035e44601a93d16ff5b9b5810a0da313af03e2a76cf4135144633e0bab
us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk:86b356231e6878000efa10a7d471ab7b332a92de@sha256:38c1da5544c717ef0e3d3492833b0fd1ce5c70fbe71eea8a9bfb0ab0b1217f1b

@ -15,8 +15,8 @@
# Pinned version of the base image is used to avoid regressions caused
# by rebuilding of this docker image. To see available versions, you can run
# "gcloud container images list-tags gcr.io/oss-fuzz-base/base-builder"
# Image(a4ad7a70fe10) is built on Apr 19, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:a4ad7a70fe10674c880ca8618a564860114a31dcdd6f9896aac89f0b2f86112a
# Image(fd89316ac4c5) is built on Aug 17, 2023
FROM gcr.io/oss-fuzz-base/base-builder@sha256:fd89316ac4c5f3e25802ca95a00062cece14f0602c5512d71ffeedc22734c0b9
# -------------------------- WARNING --------------------------------------
# If you are making changes to this file, consider changing
@ -38,7 +38,7 @@ RUN apt-get update && apt-get -y install \
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 6.1.2
ENV BAZEL_VERSION 6.3.2
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:4216fa1d9435a22ffb72e4e92b6014eeb04dab7e@sha256:585f55c6159b907a9326eaa9b7946a649724bacb2b92894c4167332a56c32b51
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:33d6fede0d99054071b50e7d0b990f0b55a35f69@sha256:697961d9bc7e8b61598b707fade0b1a5d2e4e8c12e7ed66b07ab35eb619f0722

@ -111,7 +111,7 @@ RUN apt-get update && apt-get install -y jq git cmake zlib1g-dev libtinfo-dev li
# Bazel installation
# Must be in sync with tools/bazel
ENV BAZEL_VERSION 6.1.2
ENV BAZEL_VERSION 6.3.2
# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1

Loading…
Cancel
Save