You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support platform-specific SHA256 verification
Adds support for platform-specific BAZELISK_VERIFY_SHA256 variables,
enabling SHA256 verification in multiplatform projects.
Bazelisk now checks for configuration in the following order:
1. BAZELISK_VERIFY_SHA256_NOJDK_<OS>_<ARCH> (when BAZELISK_NOJDK is enabled)
2. BAZELISK_VERIFY_SHA256_<OS>_<ARCH>
3. BAZELISK_VERIFY_SHA256 (existing behavior, fallback)
Implementation notes:
- Refactored downloadBazelIfNecessary to compute platform info once upfront
- Added FormatBazelFilename helper to avoid redundant OS/arch computation
- Hash values normalized to lowercase for case-insensitive comparison
- Full backward compatibility maintained
Fixes#522
Copy file name to clipboardExpand all lines: README.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,13 @@ Note: `last_downstream_green` support has been removed, please use `last_green`
77
77
78
78
## Where does Bazelisk get Bazel from?
79
79
80
-
By default Bazelisk retrieves Bazel releases, release candidates and binaries built at green commits from Google Cloud Storage. The downloaded artifacts are validated against the SHA256 value recorded in `BAZELISK_VERIFY_SHA256` if this variable is set in the configuration file.
80
+
By default Bazelisk retrieves Bazel releases, release candidates and binaries built at green commits from Google Cloud Storage. The downloaded artifacts can be validated against an expected SHA256 hash.
81
+
82
+
Since each platform has a different binary with a different hash, Bazelisk supports platform-specific hash variables:
83
+
84
+
-`BAZELISK_VERIFY_SHA256_<OS>_<ARCH>` - hash for a specific platform (e.g., `BAZELISK_VERIFY_SHA256_LINUX_X86_64`)
85
+
-`BAZELISK_VERIFY_SHA256_NOJDK_<OS>_<ARCH>` - hash for nojdk builds (when `BAZELISK_NOJDK` is enabled)
86
+
-`BAZELISK_VERIFY_SHA256` - fallback used when no platform-specific hash is set
81
87
82
88
As mentioned in the previous section, the `<FORK>/<VERSION>` version format allows you to use your own Bazel fork hosted on GitHub:
83
89
@@ -270,6 +276,8 @@ The following variables can be set:
Configuration variables are evaluated with precedence order. The preferred values are derived in order from highest to lowest precedence as follows:
@@ -278,7 +286,7 @@ Configuration variables are evaluated with precedence order. The preferred value
278
286
* Variables defined in the workspace root `.bazeliskrc`
279
287
* Variables defined in the user home `.bazeliskrc`
280
288
281
-
Additionally, the Bazelisk home directory is also evaluated in precedence order. The preferred value is OS-specific e.g. `BAZELISK_HOME_LINUX`, then we fall back to `BAZELISK_HOME`.
289
+
Some variables support platform-specific variants. For example, `BAZELISK_HOME_LINUX` takes precedence over `BAZELISK_HOME`, and `BAZELISK_VERIFY_SHA256_DARWIN_ARM64` takes precedence over `BAZELISK_VERIFY_SHA256`.
0 commit comments