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

Use consistent paths to bazel binaries #465

Conversation

illicitonion
Copy link
Contributor

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 illicitonion force-pushed the consistent-path-variables-content-digest branch 2 times, most recently from 395ec66 to 8cf20b6 Compare May 16, 2023 17:45
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 illicitonion force-pushed the consistent-path-variables-content-digest branch from 8cf20b6 to f17149c Compare May 16, 2023 21:46
@illicitonion
Copy link
Contributor Author

@fweikert could you take a look? Thanks!

@fweikert fweikert self-requested a review June 1, 2023 16:17
@fweikert
Copy link
Member

fweikert commented Jun 1, 2023

Nice, thank you for this PR!

@fweikert fweikert merged commit a4dca9c into bazelbuild:master Jun 1, 2023
2 checks passed
@illicitonion illicitonion deleted the consistent-path-variables-content-digest branch June 1, 2023 16:19
@meteorcloudy
Copy link
Member

BAZELISK_HOME="$BAZELISK_HOME" BAZELISK_BASE_URL=https://downloads.sourceforge.net/project/bazel.mirror bazelisk sync --only=print_path 2>&1 | tee log2

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants