release: retry uploads past Cloudflare's 524, re-checking the server first; optional direct API URL
0.29.0 and 0.30.0 both died in the publish step with curl: (56) ... error: 524 - Cloudflare's origin timeout, because GITHUB_SERVER_URL is the public host and every upload crosses the proxy. tools/ publish_release.sh now retries each upload (UPLOAD_ATTEMPTS, default 5, backing off) and asks the server what it holds before every retry: an asset already there at the local size is done, one at another size is a truncated upload and is deleted before re-sending. LUCISV_API_URL, an optional repository Actions variable passed through release.yml, names a direct http://host:port so the API bypasses the proxy; unset, the public URL is used as before. Mock-tested with a curl stand-in reproducing the 524-then-partial sequence. Work log in docs/features/ci-release. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
51869c8bf4
commit
58112d4d3b
3 files changed
+87
-11
No files matched your search
@@ -43,7 +43,12 @@ jobs:
|
||||
run: tools/prune_release_assets.sh dist "${GITHUB_REF_NAME#v}"
|
||||
- name: Extract the release notes from CHANGELOG.md
|
||||
run: tools/release_notes.sh "${GITHUB_REF_NAME#v}" > dist/RELEASE_NOTES.md
|
||||
# LUCISV_API_URL is an optional repository Actions variable naming a
|
||||
# direct http://host:port for the Gitea API, so the uploads do not go
|
||||
# through Cloudflare's 100-second origin timeout (0.29.0 and 0.30.0
|
||||
# both died there with a 524). Unset, the public URL is used.
|
||||
- name: Create the release and attach the artifacts
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
LUCISV_API_URL: ${{ vars.LUCISV_API_URL }}
|
||||
run: tools/publish_release.sh "$GITHUB_REF_NAME" dist
|
||||
@@ -186,6 +186,29 @@ versions, written notes, and all seven packages.
|
||||
is a one-line invocation of a script proven by hand on the same machine
|
||||
the runner is, which is as close as this gets without cutting a release.
|
||||
|
||||
**2026-09-02 — lead: the publish step against Cloudflare's 100-second
|
||||
origin timeout.** Releases 0.27.0–0.30.0 were pushed together after an
|
||||
ssh-key outage; the runner built all four, 0.27.0 and 0.28.0 published,
|
||||
and 0.29.0 and 0.30.0 both died in "Create the release and attach the
|
||||
artifacts" with `curl: (56) The requested URL returned error: 524` —
|
||||
Cloudflare's own page, because `$GITHUB_SERVER_URL` is the public host and
|
||||
every API call goes through the proxy, which gives the origin 100 seconds
|
||||
per request. 0.29.0's release object existed with zero assets, so the
|
||||
very first upload had timed out on a busy server. Two changes in
|
||||
`tools/publish_release.sh`, both mock-tested with a curl stand-in:
|
||||
(1) uploads retry (`UPLOAD_ATTEMPTS`, default 5, backing off 10 s × n),
|
||||
and before each retry the server is asked again what it holds — a 524 is
|
||||
the proxy giving up on the *response*, so the origin may have finished;
|
||||
an asset present at the local size is treated as attached, one at another
|
||||
size is deleted and re-sent, so a truncated file can never be published;
|
||||
(2) `LUCISV_API_URL`, an optional repository Actions variable passed by
|
||||
`release.yml`, names a direct `http://host:port` for the API so uploads
|
||||
bypass the proxy altogether; unset, nothing changes. The two stuck tags
|
||||
carry the old script and are re-run from the Actions page — that script
|
||||
was already idempotent (release reused, attached names skipped), so a
|
||||
re-run on a quieter server completes them. `docs/features/ci-release` is
|
||||
the only file set touched.
|
||||
|
||||
## QA log
|
||||
|
||||
_(no QA round — infrastructure, verified by the live v0.7.1 run; see work log)_
|
||||
|
||||
+59
-11
@@ -9,6 +9,22 @@
|
||||
# attached). A tag containing "-" (v0.8.0-rc1) is marked prerelease.
|
||||
# Re-running is safe: an existing release for the tag is reused, and an
|
||||
# asset name that is already attached is skipped.
|
||||
#
|
||||
# Two things learned from the 0.29.0 / 0.30.0 releases (2026-09-02), whose
|
||||
# uploads died with `curl: (56) ... error: 524` -- Cloudflare's origin-timeout
|
||||
# page, because $GITHUB_SERVER_URL is the public host and every request goes
|
||||
# through Cloudflare, which gives an origin 100 seconds to answer:
|
||||
# * LUCISV_API_URL, when set (the workflow passes the repository's Actions
|
||||
# variable of that name), is used for the API instead of
|
||||
# $GITHUB_SERVER_URL -- a direct http://host:port the runner can reach
|
||||
# without the proxy. The release link printed at the end still uses the
|
||||
# public URL.
|
||||
# * Every upload is retried (UPLOAD_ATTEMPTS, default 5, backing off), and
|
||||
# before each retry the server is asked again what is attached: a 524 is
|
||||
# Cloudflare giving up on the *response*, and the origin may well have
|
||||
# finished storing the file. An asset present with the local file's
|
||||
# size is treated as done; one present with a different size is deleted
|
||||
# and sent again, so a truncated upload can never be published.
|
||||
|
||||
set -eu
|
||||
|
||||
@@ -21,7 +37,9 @@ done
|
||||
notes="$dist/RELEASE_NOTES.md"
|
||||
[ -s "$notes" ] || { echo "no release notes at $notes" >&2; exit 2; }
|
||||
|
||||
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
api="${LUCISV_API_URL:-$GITHUB_SERVER_URL}/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
[ -n "${LUCISV_API_URL:-}" ] && echo "using the direct API URL $LUCISV_API_URL"
|
||||
attempts=${UPLOAD_ATTEMPTS:-5}
|
||||
auth="Authorization: token $GITHUB_TOKEN"
|
||||
|
||||
prerelease=false
|
||||
@@ -39,17 +57,47 @@ else
|
||||
echo "created release $tag (id $id)"
|
||||
fi
|
||||
|
||||
attached=$(curl -sS -H "$auth" "$api/releases/$id/assets" | jq -r '.[].name')
|
||||
# What the server holds for this release, as "name size" lines.
|
||||
attached_assets() {
|
||||
curl -sS -H "$auth" "$api/releases/$id/assets" \
|
||||
| jq -r '.[] | "\(.name) \(.size) \(.id)"'
|
||||
}
|
||||
|
||||
# Attach one file, or confirm the server already has it whole. Returns 0
|
||||
# once an asset with the file's name and size is on the server.
|
||||
attach() {
|
||||
f=$1
|
||||
name=$(basename "$f")
|
||||
size=$(wc -c < "$f" | tr -d ' ')
|
||||
n=0
|
||||
while :; do
|
||||
have=$(attached_assets | awk -v n="$name" '$1 == n { print $2, $3 }')
|
||||
if [ -n "$have" ]; then
|
||||
have_size=${have%% *}
|
||||
have_id=${have##* }
|
||||
if [ "$have_size" = "$size" ]; then
|
||||
[ $n -eq 0 ] && echo "already attached: $name" || echo "attached after retry: $name"
|
||||
return 0
|
||||
fi
|
||||
echo "server holds $name at $have_size bytes, local is $size: deleting the partial upload" >&2
|
||||
curl -sSf -X DELETE -H "$auth" "$api/releases/$id/assets/$have_id" >/dev/null || true
|
||||
fi
|
||||
n=$((n + 1))
|
||||
[ $n -le "$attempts" ] || { echo "giving up on $name after $attempts attempts" >&2; return 1; }
|
||||
[ $n -eq 1 ] && echo "attaching $name" || echo "attaching $name (attempt $n of $attempts)"
|
||||
if curl -sSf -X POST -H "$auth" -F "attachment=@$f" \
|
||||
"$api/releases/$id/assets?name=$name" >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
# Back off before asking the server again; a proxy timeout says nothing
|
||||
# about whether the origin finished.
|
||||
sleep $((10 * n))
|
||||
done
|
||||
}
|
||||
|
||||
for f in "$dist"/*; do
|
||||
[ -f "$f" ] || continue
|
||||
name=$(basename "$f")
|
||||
[ "$name" = RELEASE_NOTES.md ] && continue
|
||||
if printf '%s\n' "$attached" | grep -qxF "$name"; then
|
||||
echo "already attached: $name"
|
||||
continue
|
||||
fi
|
||||
echo "attaching $name"
|
||||
curl -sSf -X POST -H "$auth" -F "attachment=@$f" \
|
||||
"$api/releases/$id/assets?name=$name" >/dev/null
|
||||
[ "$(basename "$f")" = RELEASE_NOTES.md ] && continue
|
||||
attach "$f"
|
||||
done
|
||||
echo "release $tag complete: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$tag"
|
||||
Reference in new issue
Block a user