Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bazel] Bump Bazel version to 6.2.1 #17021

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

dmcardle
Copy link
Contributor

@dmcardle dmcardle commented Jan 10, 2023

This PR experimentally bumps the Bazel version to 6.0.0 6.2.1, the latest release. Let's see what CI makes of it.

CC @arunthomas

@dmcardle dmcardle self-assigned this Jan 10, 2023
Copy link
Contributor

@drewmacrae drewmacrae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some testing earlier and it looks good. Passed all non-broken bazel tests we have IIRC. We need this for remote execution to let us tag fpga tests as "exclusive-if-local"

This might need users to update and should probably be scheduled and announced.

LGTM

@dmcardle
Copy link
Contributor Author

Thanks, @drewmacrae! I saw your PR (#16949) and hoped I could separate this part of it.

@dmcardle
Copy link
Contributor Author

@timothytrippel Do you have concerns about the failing airgapped build? It looks like it hits UnrecoverableHttpException, which is a different failure mode than I reported in #16960.

@timothytrippel
Copy link
Contributor

@timothytrippel Do you have concerns about the failing airgapped build? It looks like it hits UnrecoverableHttpException, which is a different failure mode than I reported in #16960.

Yes, we should probably test this in our airgapped environment before pushing this through.

@dmcardle dmcardle force-pushed the dmcardle/bump-bazel-version branch from 63d2cbd to e0724db Compare January 18, 2023 18:37
@a-will
Copy link
Contributor

a-will commented Jan 18, 2023

Looks like some more dependencies may need to be added to the fetch list in util/prep-bazel-airgapped-build.sh

INFO: Repository remote_java_tools instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:363:6: in <toplevel>
  /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule http_archive defined at:
  /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
WARNING: Download from https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Unknown host: mirror.bazel.build
WARNING: Download from https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Unknown host: github.com
ERROR: An error occurred during the fetch of repository 'remote_java_tools':
   Traceback (most recent call last):
	File "/home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
		download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: /DEFAULT.WORKSPACE.SUFFIX:363:6: fetching http_archive rule //external:remote_java_tools: Traceback (most recent call last):
	File "/home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
		download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/jdk/BUILD:327:27: @bazel_tools//tools/jdk:toolchain_java8 depends on @remote_java_tools//:JavaBuilder in repository @remote_java_tools which failed to fetch. no such package '@remote_java_tools//': java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/jdk/BUILD:327:27: @bazel_tools//tools/jdk:toolchain_java8 depends on @remote_java_tools//:GenClass in repository @remote_java_tools which failed to fetch. no such package '@remote_java_tools//': java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/jdk/BUILD:327:27: @bazel_tools//tools/jdk:toolchain_java8 depends on @remote_java_tools//:TurbineDirect in repository @remote_java_tools which failed to fetch. no such package '@remote_java_tools//': java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/bazel_tools/tools/jdk/BUILD:327:27: @bazel_tools//tools/jdk:toolchain_java8 depends on @remote_java_tools//:jacoco_coverage_runner_filegroup in repository @remote_java_tools which failed to fetch. no such package '@remote_java_tools//': java.io.IOException: Error downloading [https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip, https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip] to /home/vsts/.cache/bazel/_bazel_vsts/5c27df7f718ab35828b0e0cfe0993663/external/remote_java_tools/temp9415537091301209138/java_tools-v11.9.zip: Unknown host: github.com
ERROR: Analysis of target '//sw/device/silicon_creator/rom/e2e:rom_e2e_debug_test_otp_rma' failed; build aborted:

@dmcardle dmcardle force-pushed the dmcardle/bump-bazel-version branch from e0724db to e3d1f57 Compare January 18, 2023 19:40
@dmcardle dmcardle marked this pull request as ready for review January 18, 2023 20:34
@dmcardle
Copy link
Contributor Author

I had to add a couple arguments to the bazel fetch command, but Bazel 6 now passes the airgapped build test!

@dmcardle
Copy link
Contributor Author

I see that //sw/device/lib/ujson/rust:roundtrip_test failed on CI:

---- test::test_foo stdout ----
sent: {
  "foo": 5,
  "bar": 10,
  "message": "Hello"
}
thread 'test::test_foo' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`:

Oddly, it repeatedly passes on my machine. I even tried running it a bunch of times, since it seems to be a randomized test.

./bazelisk.sh test --runs_per_test=5000 --cache_test_results=no //sw/device/lib/ujson/rust:roundtrip_test

I think I'll ask CI to try it again.

@drewmacrae
Copy link
Contributor

I think we're on-track to have the extra-resources feature get cherry-picked to 6.1.0 so we'll probably want to upgrade when it's released.

@dmcardle
Copy link
Contributor Author

@drewmacrae Great! Let's proceed to upgrade to Bazel 6 and then upgrade to 6.1.0 when it's time :)

@cfrantz Do you have any thoughts on the failure in //sw/device/lib/ujson/rust:roundtrip_test? It feels unrelated to me, but I don't want to lose track of it.

@drewmacrae
Copy link
Contributor

Now that we have bazel with "extra resources" I'd prefer we use something later than 6.1.0 so I've added #17664

@alphan
Copy link
Contributor

alphan commented Jul 5, 2023

Do we want to revive this now that ES freeze is over?

@dmcardle @arunthomas @a-will @timothytrippel @cfrantz

@dmcardle
Copy link
Contributor Author

dmcardle commented Jul 6, 2023

I'm biased, but I think this is a good idea!

Bazel 6 adds support for Bzlmod, which may simplify our third-party dependencies.

The new cquery flag --output=files addresses a minor (but recurring) pain point. We could probably replace bazelisk.sh's implementation of outquery, which I recall being a little buggy with multiple files.

The latest release, 6.2.1, also includes Drew's PR that I believe would help a single Bazel instance manage multiple FPGAs — basically a finer-grained control than the "exclusive" tag. There'd still be some integration work like teaching opentitantool how to select the correct JTAG adapter for a given FPGA. bazelbuild/bazel#17229

Release notes: https://github.com/bazelbuild/bazel/releases/tag/6.0.0

@timothytrippel
Copy link
Contributor

Yes I think we should be safe to upgrade. Once this PR gets rebased and is passing CI I can test it on our nightly regression infra to make sure the newer version works there too.

@timothytrippel timothytrippel requested review from cfrantz and removed request for drewmacrae July 12, 2023 19:37
@dmcardle dmcardle force-pushed the dmcardle/bump-bazel-version branch from e3d1f57 to 4578cb8 Compare July 13, 2023 13:13
@dmcardle dmcardle changed the title [bazel] Bump Bazel version to 6.0.0 [bazel] Bump Bazel version to 6.2.1 Jul 13, 2023
@dmcardle
Copy link
Contributor Author

Thanks, folks!

Just rebased and changed from Bazel 6.0.0 to 6.2.1.

I also created an experimental PR to see if we can omit the changes to the airgapped script: #19187.

@dmcardle
Copy link
Contributor Author

Yes I think we should be safe to upgrade. Once this PR gets rebased and is passing CI I can test it on our nightly regression infra to make sure the newer version works there too.

@timothytrippel CI is green! Could you give this a shot on the nightly infra? I'll wait for you to give the go-ahead before merging this PR.

@timothytrippel
Copy link
Contributor

I tested this and it seems to work on our infrastructure, so I am merging.

@timothytrippel timothytrippel merged commit 7bbcd1f into lowRISC:master Jul 14, 2023
@dmcardle dmcardle deleted the dmcardle/bump-bazel-version branch July 14, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants