Skip to content

Commit 07a3643

Browse files
committed
mirror: a 502 for an asset the mirror holds is not a missing asset
The v2026.8.25.1 release failed its completeness gate twice. Both runs reported all 16 assets "already mirrored, skipping", and the gate then failed on one of them: [mirror] FAIL: missing/unverified: https://gitcode.com/xlings-res/mcpp/.../linux-x86_64.tar.gz 502ERR https://gitcode.com/.../linux-x86_64.tar.gz Fetched by hand a minute later it was 5,772,395 bytes whose sha256 matched the published checksum exactly. The file was never missing; GitCode's edge answered 502 once, and a single unretried GET decided the release. Both verification GETs now retry with `--retry-all-errors` — not plain `--retry`, which covers transient HTTP codes but not the transport-layer failures this path also sees; that distinction has cost this repository a run of red CI before. Also fixes the status the log reports. `|| echo ERR` APPENDS: `-f` makes curl exit non-zero on a 502 while `-w` has already written the code, so the variable read `502ERR` and no one could grep the log for a status. ERR is now substituted only when curl printed nothing at all.
1 parent d5cda84 commit 07a3643

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

.github/tools/mirror_res.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ done
133133
# The final completeness gate below still does FULL GETs.
134134
probe() { # host_path asset → 0 iff the object serves bytes
135135
local code
136-
code=$(curl -fsSL -o /dev/null -w '%{http_code}' -r 0-0 -L "$1" 2>/dev/null)
136+
code=$(curl -fsS -o /dev/null -w '%{http_code}' -r 0-0 -L \
137+
--retry 3 --retry-all-errors --retry-delay 2 --max-time 60 \
138+
"$1" 2>/dev/null)
137139
[[ "$code" == 200 || "$code" == 206 ]]
138140
}
139141

@@ -285,7 +287,24 @@ hosts=()
285287
[[ "${GTC_ENABLED:-0}" == 1 ]] && hosts+=("gitcode.com/$GTC_DST")
286288
for host in "${hosts[@]}"; do
287289
for a in "${ASSETS[@]}"; do
288-
code=$(curl -fsSL -o /dev/null -w '%{http_code}' -L "https://${host}/releases/download/${VER}/${a}" 2>/dev/null || echo ERR)
290+
# ⚠️ RETRIED, BECAUSE A MIRROR CAN ANSWER 502 FOR AN ASSET IT HOLDS.
291+
# v2026.8.25.1 failed here twice: every one of the 16 assets reported
292+
# "already mirrored, skipping", and the gate then failed one of them on a
293+
# single 502 from GitCode's edge. Fetched by hand a minute later it was
294+
# 5,772,395 bytes with the published sha256 — the file was never missing.
295+
#
296+
# `--retry-all-errors` and not `--retry`: plain `--retry` covers transient
297+
# HTTP codes but not the transport-layer failures this path also sees, and
298+
# this repository has paid for that distinction before (ci-curl-52).
299+
#
300+
# ⚠️ `|| echo ERR` APPENDS, it does not replace — `-f` makes curl exit
301+
# non-zero on 502 while `-w` has already written the code, so the variable
302+
# read `502ERR` and the log could not be grepped for a status. Substituted
303+
# only when curl printed nothing at all.
304+
code=$(curl -fsS -o /dev/null -w '%{http_code}' -L \
305+
--retry 3 --retry-all-errors --retry-delay 3 --max-time 120 \
306+
"https://${host}/releases/download/${VER}/${a}" 2>/dev/null)
307+
[[ -n "$code" ]] || code=ERR
289308
echo " $code https://${host}/releases/download/${VER}/${a}"
290309
[[ "$code" == 200 ]] || { rc=1; echo "[mirror] FAIL: missing/unverified: https://${host}/releases/download/${VER}/${a}" >&2; }
291310
done

0 commit comments

Comments
 (0)