Skip to content

Commit

Permalink
Use a custom bazel-postsubmit.yml file for Bazel in downstream pipeli…
Browse files Browse the repository at this point in the history
…ne (#1878)

Fixes bazelbuild/bazel#21292

After
bazelbuild/bazel@a54a393,
the canonical repo name returned by Bazel@HEAD no longer matches the
name in MODULE.bazel.lock, therefore we need to run `bazel mod deps
--lockfile_mode=update` to re-generate the lockfile before running the
build.

This is done by changing the postsubmi.yml file for Bazel to a custom
version located in the CI repo, which can be updated by running
`./update-bazel-postsubmit.sh` under `./pipelines`.

We may revert this change after we update Bazel to 7.1 for building
Bazel itself.
  • Loading branch information
meteorcloudy authored Feb 12, 2024
1 parent f2bb6fc commit de5ab84
Show file tree
Hide file tree
Showing 4 changed files with 500 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildkite/bazelci.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
"Bazel": {
"git_repository": "https://github.com/bazelbuild/bazel.git",
"file_config": ".bazelci/postsubmit.yml",
"http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/pipelines/bazel-postsubmit.yml",
"pipeline_slug": "bazel-bazel",
},
"Bazel Bench": {
Expand Down
66 changes: 66 additions & 0 deletions pipelines/bazel-postsubmit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
diff --git bazel-postsubmit.yml bazel-postsubmit.yml
index 1ee30a9a94..7995b62de5 100644
--- bazel-postsubmit.yml
+++ bazel-postsubmit.yml
@@ -1,4 +1,5 @@
---
+# Update this file by running ./update-bazel-postsubmit.sh under the same directory

tasks:
centos7_java11_devtoolset10:
@@ -8,6 +9,7 @@ tasks:
- rm -f WORKSPACE.bzlmod.bak
- rm -rf $HOME/bazeltest
- mkdir $HOME/bazeltest
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-linux"
build_targets:
@@ -73,6 +75,7 @@ tasks:
- rm -f WORKSPACE.bzlmod.bak
- rm -rf $HOME/bazeltest
- mkdir $HOME/bazeltest
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-linux"
build_targets:
@@ -132,6 +135,7 @@ tasks:
- rm -f WORKSPACE.bzlmod.bak
- rm -rf $HOME/bazeltest
- mkdir $HOME/bazeltest
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-linux"
build_targets:
@@ -165,6 +169,7 @@ tasks:
- rm -rf $HOME/bazeltest
- mkdir $HOME/bazeltest
- ln -sf $OUTPUT_BASE/external $HOME/bazeltest/external
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-macos"
build_targets:
@@ -228,6 +233,7 @@ tasks:
- rm -rf $HOME/bazeltest
- mkdir $HOME/bazeltest
- ln -sf $OUTPUT_BASE/external $HOME/bazeltest/external
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-macos"
build_targets:
@@ -289,6 +295,7 @@ tasks:
- mklink /J C:\b\bazeltest_external %OUTPUT_BASE:/=\%\external
batch_commands:
- powershell -Command "(Get-Content WORKSPACE.bzlmod) -Replace '# android_', 'android_' | Set-Content WORKSPACE.bzlmod"
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ci-windows"
build_targets:
@@ -359,6 +366,7 @@ tasks:
-e 's/^# android_sdk_repository/android_sdk_repository/'
-e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod
- rm -f WORKSPACE.bzlmod.bak
+ - bazel mod deps --lockfile_mode=update
build_flags:
- "--config=ubuntu2004_java11"
- "--remote_executor=grpcs://remotebuildexecution.googleapis.com"
Loading

0 comments on commit de5ab84

Please sign in to comment.