bazelbuild / bazelisk

A user-friendly launcher for Bazel.
Apache License 2.0
1.96k stars 302 forks source link

Use consistent paths to bazel binaries #465

Closed illicitonion closed 1 year ago

illicitonion commented 1 year ago

Before this change, changing which mirror you were downloading from would change the $PATH environment variable bazel is run with, even though the bazel binaries being pointed to are identical. This can cause repository rules to invalidate and re-run.

Instead, store downloaded bazels in directories keyed off of the sha256 of the bazel binary itself, and track the metadata of a mirror+version -> sha256.

This avoid spurious rebuilds when only changing the URL bazelisk would use to download bazel.

illicitonion commented 1 year ago

@fweikert could you take a look? Thanks!

fweikert commented 1 year ago

Nice, thank you for this PR!

meteorcloudy commented 8 months ago

https://github.com/bazelbuild/bazelisk/blob/b7f5c7570df35ce2273afa0c15f4bc5038fb126a/bazelisk_test.sh#L336

Bazelisk postsubmit is now failing with

INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
2023/11/10 00:08:53 Downloading https://downloads.sourceforge.net/project/bazel.mirror/6.2.0/bazel-6.2.0-linux-x86_64...
2023/11/10 00:08:53 could not download Bazel: failed to download bazel: failed to download bazel: HTTP GET https://downloads.sourceforge.net/project/bazel.mirror/6.2.0/bazel-6.2.0-linux-x86_64 failed with error 404

Any idea how to fix the test?

fweikert commented 8 months ago

Looks like sourceforge dropped 6.2.0. We can switch to 6.2.1, but that will lead to the same error in the future.