Retry the whole nsyte download until the binary runs

From this coordinator the 115 MB release download fails about half the
time, mid-transfer, with an SSL record-mac error; curl's own --retry does
not help because each attempt breaks identically. Loop the fetch, force
HTTP/1.1, and run the binary before accepting it.

The durable fix is baking nsyte into the CI image.
This commit is contained in:
Alex Gleason committed 2026-08-17 02:55:03 -05:00
1 parent f951f21535
commit 0d73c79d4c
1 file changed
+25 -11
+25 -11
View File
@@ -51,17 +51,31 @@ jobs:
# Pin the binary. An unversioned install has been observed pulling
# 0.10.1, which emits legacy kind-34128 events that every current
# gateway ignores while still reporting a successful deploy.
# --retry-all-errors covers the transport faults this download has
# actually hit here ("SSL_read: decryption failed or bad record
# mac"), which curl does not consider retryable on its own. -f keeps
# an HTTP error page from being saved as the binary, and the version
# check fails the step rather than letting a truncated download
# surface later as a confusing nsyte error.
curl -fsSL --retry 5 --retry-delay 3 --retry-all-errors --max-time 300 \
-o /usr/local/bin/nsyte \
https://github.com/sandwichfarm/nsyte/releases/download/v0.27.2/nsyte-linux-0.27.2
chmod +x /usr/local/bin/nsyte
nsyte --version
# This 115 MB download is the single flakiest thing in the job: from
# this coordinator it fails perhaps half the time, mid-transfer, with
# "SSL_read: decryption failed or bad record mac". curl's own --retry
# is not enough because every attempt breaks the same way, so the
# whole fetch is retried in a loop, forcing HTTP/1.1 (the fault has
# the shape of an HTTP/2 framing problem) and proving the binary
# actually runs before accepting it. A truncated download otherwise
# surfaces much later as a confusing nsyte error.
#
# The durable fix is to bake nsyte into the coordinator's CI image,
# the way it already pre-bakes the other toolchains.
NSYTE_URL=https://github.com/sandwichfarm/nsyte/releases/download/v0.27.2/nsyte-linux-0.27.2
ok=""
for attempt in 1 2 3 4 5; do
if curl -fsSL --http1.1 --retry 2 --retry-delay 5 --retry-all-errors \
--connect-timeout 20 --max-time 900 -o /usr/local/bin/nsyte "$NSYTE_URL" \
&& chmod +x /usr/local/bin/nsyte \
&& nsyte --version; then
ok=yes
break
fi
echo "nsyte download attempt $attempt failed; retrying in 10s"
sleep 10
done
test -n "$ok" || { echo "could not download a working nsyte after 5 attempts"; exit 1; }
nsyte validate