-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(ci): portable hash parsing in nix-hashes workflow #11533
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
fix(ci): portable hash parsing in nix-hashes workflow #11533
Conversation
The sed -E regex with \s+ behaves differently on BSD sed (macOS) vs GNU sed (Linux), causing the hash extraction to fail on darwin runners and include 'got:' prefix in the output. Replace complex sed parsing with portable grep -oE to extract sha256 hashes directly. Use tail -n1 to get the 'got:' hash (second match) since nix outputs 'specified:' hash first. Ref: anomalyco#11530 (comment)
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: The only other PR found is #11530 ("ci: fix nix hash issue"), which is actually the issue that PR #11533 is meant to close (as stated in the description: "Closes #11530"). This is not a duplicate - #11530 is the issue being addressed by the current PR. No duplicate PRs found |
|
wanna just add the token change onto this pr too: |
|
I think it'll fix that push failure |
@rekram1-node, @gigamonster256: that PR with #11530 and the nix packaging pipeline should work again for all platform. |
You want me to integrate your changes also in that PR? |
|
I'm a little bit away from knowing why the darwin vs linux build hashes differ, looks like the linux build of the darwin node_modules is pulling in extra deps Details...Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/which-typed-array: 1.1.20@@@1 |
The PR explain it: |
|
I understand that, but... why? for instance the linux based darwin node_modules installs sst-darwin-arm64 but the darwin based one doesnt. That seems wrong. |
The dependencies tree has leaves that depend on the platform: fs notification, etc.. And most package managers in the JS ecosystem does not handle it strictly and do performance trade-off at computing the "merged" tree of the really needed deps. |
Summary
Problem
PR #11495 introduced a regression where darwin hashes in
nix/hashes.jsonincludegot:prefix (e.g.,got:sha256-...instead ofsha256-...).The
sed -Eregex using\s+behaves differently on BSD sed (macOS) vs GNU sed (Linux), causing the substitution to fail on darwin runners.Ref: #11530 (comment)
Solution
Replace complex sed parsing with portable
grep -oEto extract sha256 hashes directly. Usetail -n1to get thegot:hash (second match) since nix outputsspecified:hash first.Ref: #11530