Upload: retry server errors

The forge answered 504 to dnf-package-store's x86_64 RPM, uploaded just
after its aarch64 one; the build was fine and the RPM never landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Philip Peterson 2026-11-03 22:09:35 -09:00
parent 8c5362376a
commit 080409370a

View file

@ -86,11 +86,20 @@ runs:
netrc=$(mktemp); trap 'rm -f "$netrc"' EXIT; chmod 600 "$netrc"
host=${URL#https://}; host=${host%%/*}
printf 'machine %s login %s password %s\n' "$host" "$REGISTRY_USERNAME" "$REGISTRY_PASSWORD" >"$netrc"
# The forge rebuilds and signs the group's metadata on each upload, and
# answered 504 to one landing right after another (dnf-package-store,
# 2026-11-04): retry server errors, with a growing wait.
for f in out/*.rpm; do
code=$(curl -sS -o /dev/null -w '%{http_code}' --netrc-file "$netrc" --upload-file "$f" "$URL")
echo "$code ${f#out/}"
# 409: this exact version is there already.
[ "$code" = 201 ] || [ "$code" = 409 ]
for try in 1 2 3 4 5 6; do
code=$(curl -sS -o /dev/null -w '%{http_code}' --netrc-file "$netrc" --upload-file "$f" "$URL" || true)
echo "$code ${f#out/}"
# 409: this exact version is there already (also when a retried
# upload had landed after all).
[ "$code" = 201 ] || [ "$code" = 409 ] && continue 2
case $code in 5??|000) [ "$try" = 6 ] || { sleep $((try * 20)); continue; } ;; esac
exit 1
done
exit 1
done
- name: Clean up