feat: support platform-specific SHA256 verification#766
feat: support platform-specific SHA256 verification#766albertocavalcante wants to merge 1 commit intobazelbuild:masterfrom
Conversation
658831a to
76873b5
Compare
f78653c to
81f96d5
Compare
|
|
||
| Since each platform has a different binary with a different hash, Bazelisk supports platform-specific hash variables: | ||
|
|
||
| - `BAZELISK_VERIFY_SHA256_<OS>_<ARCH>` - hash for a specific platform (e.g., `BAZELISK_VERIFY_SHA256_LINUX_X86_64`) |
There was a problem hiding this comment.
Nit: can you please enumerate all valid values here? There might be some confusion regarding darwin vs macos or arm64 vs aarch64.
There was a problem hiding this comment.
Absolutely! And agreed. Thanks for the feedback and review Florian. I should resume working in this during the weekend.
There was a problem hiding this comment.
Thank you for the feature (and the tests)!
|
@albertocavalcante Do you need any help with this feature? From what I can see, you've already done most of the work. |
|
@valco1994, thank you for offering assistance. I really appreciate it. To be honest, I had some issues with GitHub recently, and as a side effect, I ended up forgetting to finish it. I'll resume and finish it today or this weekend; otherwise, I will let you know. Apologies. |
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 bazelbuild#522
81f96d5 to
4718ef3
Compare
|
Wounderful, thank you for your work! |
Adds support for platform-specific
BAZELISK_VERIFY_SHA256variables, enabling SHA256 verification in multiplatform projects.Fixes #522
Problem
The current
BAZELISK_VERIFY_SHA256only accepts a single hash value, but Bazel binaries have different SHA256 hashes per platform. Projects building on multiple platforms cannot use SHA256 verification.Solution
Since each platform has a different binary with a different hash, Bazelisk now supports platform-specific hash variables:
BAZELISK_VERIFY_SHA256_<OS>_<ARCH>- hash for a specific platform (e.g.,BAZELISK_VERIFY_SHA256_LINUX_X86_64)BAZELISK_VERIFY_SHA256_NOJDK_<OS>_<ARCH>- hash for nojdk builds (whenBAZELISK_NOJDKis enabled)BAZELISK_VERIFY_SHA256- fallback used when no platform-specific hash is setSupported Platforms
DARWINARM64,X86_64LINUXARM64,X86_64WINDOWSARM64,X86_64Example
.bazeliskrcImplementation Notes
downloadBazelIfNecessaryto compute platform info once upfrontFormatBazelFilenamehelper inplatformspackageBAZELISK_VERIFY_SHA256Test Plan
getExpectedSHA256(7 focused tests)FormatBazelFilename(2 tests)