Skip to content

Commit 5633f75

Browse files
committed
ci: fail the mdBook download on an HTTP error
The mdBook step kept `-sSL` while the cargo-nextest steps use `-LsSf`, so it still had the failure mode this branch set out to remove. Without `--fail`, curl treats an HTTP error as a successful transfer: it writes the error page to /tmp/mdbook.tar.gz and exits 0, and `tar` then fails with "not in gzip format" instead of reporting the 403 or 404 that actually happened. `--retry` cannot help either, because curl never classifies the response as an error to retry. Reproduced against a non-existent release asset: without -f, curl exits 0 having written a 9-byte "Not Found" body and tar exits 2 with no usable message; with -f, curl exits 22 and says "The requested URL returned error: 404". The real asset still downloads and extracts (mdbook v0.4.40). Reported by aws-sam-tooling-bot on #843.
1 parent 7e16ee9 commit 5633f75

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎.github/workflows/docs.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ jobs:
2626
- name: Install mdBook
2727
run: |
2828
mkdir -p $HOME/bin
29-
curl --retry 5 --retry-all-errors --retry-delay 5 -sSL \
29+
# -f so an HTTP error is an error: without it curl writes the error page to
30+
# the output file and exits 0, and tar then fails with "not in gzip format"
31+
# — the same misleading failure this commit set out to remove. It is also
32+
# what lets --retry see a 5xx as retryable at all.
33+
curl --retry 5 --retry-all-errors --retry-delay 5 -sSLf \
3034
https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz \
3135
-o /tmp/mdbook.tar.gz
3236
tar -xz -C $HOME/bin -f /tmp/mdbook.tar.gz

0 commit comments

Comments
 (0)