fix: restore step died with exit 141 (SIGPIPE) on every cache hit — act runs step scripts with 'bash -e -o pipefail', so the 'FIRST_ENTRY=$(tar -tf ... | head -1)' detection line killed the step: head -1 closes the pipe after the first line, tar gets SIGPIPE (141), and pipefail propagates it as the script exit status (observed: 'Cache hit' then 'Process completed with exit code 141', step duration 0s, on deploy-leptos after this detection line was added on 2026-08-14)

The previous restores predate the detection line, which is why this only started failing on 2026-08-17. Suppress the pipeline status with '|| true' — FIRST_ENTRY still captures the first archive entry, and a genuinely unreadable archive degrades to the legacy fallback / cache-hit=false path as before.
This commit is contained in:
2026-08-17 11:18:46 +08:00
parent 8cdec4603c
commit d4b6457b06
+6 -1
View File
@@ -45,7 +45,12 @@ runs:
# path. Legacy archives embed the absolute path of the run that
# saved them; fall back to extracting them to "/" (status quo,
# they are TTL-pruned within the retention window anyway).
FIRST_ENTRY=$(tar -tf "$ARCHIVE" 2>/dev/null | head -1)
# NOTE: `|| true` is mandatory — act runs step scripts with
# `bash -e -o pipefail`, and `head -1` closes the pipe after the
# first line, so tar dies with SIGPIPE (141) and pipefail turns
# that into a step failure (restore only ever "worked" before
# this detection line existed).
FIRST_ENTRY=$(tar -tf "$ARCHIVE" 2>/dev/null | head -1 || true)
if [ "${FIRST_ENTRY%%/*}" = "$(basename "$EXPANDED_PATH")" ]; then
echo "Restoring to: $(dirname "$EXPANDED_PATH")"
tar -xf "$ARCHIVE" -C "$(dirname "$EXPANDED_PATH")" 2>/dev/null