From 1e180d61eaf3897266be80d87dbe09c61018169c Mon Sep 17 00:00:00 2001 From: Bradley Smith <70659641+brsm019@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:04:02 +0000 Subject: [PATCH] [ubuntu] Configure USE_BAZEL_FALLBACK_VERSION for Bazelisk (#13605) --- images/ubuntu/scripts/build/install-bazel.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/images/ubuntu/scripts/build/install-bazel.sh b/images/ubuntu/scripts/build/install-bazel.sh index 70fe46f77..c336cea7e 100644 --- a/images/ubuntu/scripts/build/install-bazel.sh +++ b/images/ubuntu/scripts/build/install-bazel.sh @@ -6,11 +6,19 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/install.sh +source $HELPER_SCRIPTS/etc-environment.sh # Install bazelisk npm install -g @bazel/bazelisk -# run bazelisk once in order to install /usr/local/bin/bazel binary -sudo -u $SUDO_USER bazel version +# Run bazelisk once in order to install /usr/local/bin/bazel binary +bazel version + +# Get the installed Bazel version from bazelisk +BAZEL_VERSION=$(bazel --version | grep "Build label:" | awk '{print $3}') + +# Set USE_BAZEL_FALLBACK_VERSION so that users without .bazelversion +# get the preinstalled version instead of downloading latest +set_etc_environment_variable "USE_BAZEL_FALLBACK_VERSION" "silent:${BAZEL_VERSION}" invoke_tests "Tools" "Bazel"