File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,14 +56,24 @@ jobs:
5656 BUILD_LOG=$(mktemp)
5757 trap 'rm -f "$BUILD_LOG"' EXIT
5858
59- # Build with fakeHash to trigger hash mismatch and reveal correct hash
60- nix build ".#packages.${SYSTEM}.node_modules_updater" --no-link 2>&1 | tee "$BUILD_LOG" || true
59+ HASH=""
60+ MAX_ATTEMPTS=3
61+ for ((ATTEMPT = 1; ATTEMPT <= MAX_ATTEMPTS; ATTEMPT++)); do
62+ # Build with fakeHash to trigger hash mismatch and reveal correct hash
63+ nix build ".#packages.${SYSTEM}.node_modules_updater" --no-link 2>&1 | tee "$BUILD_LOG" || true
6164
62- # Extract hash from build log with portability
63- HASH="$(nix run --inputs-from . nixpkgs#gnugrep -- -oP 'got:\s*\Ksha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | tail -n1 || true)"
65+ HASH="$(nix run --inputs-from . nixpkgs#gnugrep -- -oP 'got:\s*\Ksha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | tail -n1 || true)"
66+
67+ [ -n "$HASH" ] && break
68+
69+ if [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; then
70+ echo "::warning::Attempt ${ATTEMPT}/${MAX_ATTEMPTS} produced no hash for ${SYSTEM}; retrying in $((ATTEMPT * 10))s"
71+ sleep $((ATTEMPT * 10))
72+ fi
73+ done
6474
6575 if [ -z "$HASH" ]; then
66- echo "::error::Failed to compute hash for ${SYSTEM}"
76+ echo "::error::Failed to compute hash for ${SYSTEM} after ${MAX_ATTEMPTS} attempts "
6777 cat "$BUILD_LOG"
6878 exit 1
6979 fi
You can’t perform that action at this time.
0 commit comments