Skip to content

Commit fea1f3d

Browse files
authored
A more reliable way of installing bazel on windows workers (grpc#28835)
* more reliable bazel installation for win bazel RBE builds * win RBE build already using the same credentials * also recognize MSYS_NT returned by kokoro workers
1 parent d1db000 commit fea1f3d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tools/bazel

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ then
4141
fi
4242

4343
# IMPORTANT: if you update the version here, other parts of infrastructure might needs updating as well
44-
# (e.g. win RBE builds, sanity checks, bazel toolchains etc.)
44+
# (e.g. sanity checks, bazel toolchains etc.)
4545
VERSION=${OVERRIDE_BAZEL_VERSION:-4.2.1}
4646
echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." >&2
4747

@@ -62,6 +62,9 @@ case $(uname -sm) in
6262
"Darwin x86_64")
6363
suffix=darwin-x86_64
6464
;;
65+
"MINGW"* | "MSYS_NT"*)
66+
suffix=windows-x86_64.exe
67+
;;
6568
*)
6669
echo "Unsupported architecture: $(uname -sm)" >&2
6770
exit 1

tools/internal_ci/windows/bazel_rbe.bat

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ cd github/grpc
2626

2727
call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
2828

29-
@rem TODO(jtattermusch): make this generate less output
30-
@rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync
31-
choco install bazel -y --version 4.2.1 --limit-output || exit /b 1
29+
@rem Install bazel
30+
@rem Side effect of the tools/bazel script is that it downloads the correct version of bazel binary.
31+
mkdir C:\bazel
32+
bash -c "tools/bazel --version && cp tools/bazel-*.exe /c/bazel/bazel.exe"
33+
set PATH=C:\bazel;%PATH%
34+
bazel --version
3235

3336
@rem Generate a random UUID and store in "bazel_invocation_ids" artifact file
3437
powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
3538
set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
3639

37-
@rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE.
3840
bazel --bazelrc=tools/remote_build/windows.bazelrc --output_user_root=T:\_bazel_output test --invocation_id="%BAZEL_INVOCATION_ID%" %BAZEL_FLAGS% --workspace_status_command=tools/remote_build/workspace_status_kokoro.bat //test/...
3941
set BAZEL_EXITCODE=%errorlevel%
4042

0 commit comments

Comments
 (0)