From 61f5858ec1ab972580ac5b050c085016fff07955 Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Tue, 3 Nov 2026 04:38:06 +0800 Subject: [PATCH] Retry release asset uploads in CI The rolling jobs of the desktop and check workflows stage a draft release and upload the installers in one attempt. GitHub answered one upload with HTTP 408 (body timed out), which failed the desktop job although every build had succeeded. Try each upload up to three times with a growing pause, and pass --clobber so an asset a cut-off attempt left behind is replaced rather than refused. The size check that follows still fails the job on a truncated or missing asset. Change-Id: I2d9092d7df3f297850ed3c33ce017e30a3de31f4 --- .github/workflows/check.yml | 10 +++++++++- .github/workflows/desktop.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 41e9cd51a..5586b26b8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1152,7 +1152,15 @@ jobs: gh release create "$staged" --draft --target "$GITHUB_SHA" \ --title "$tag" --notes "Automated build of ${GITHUB_SHA:0:7}." - gh release upload "$staged" "${assets[@]}" + # An upload can time out (HTTP 408) on the GitHub side with nothing + # wrong in the build. --clobber replaces an asset a cut-off attempt + # left behind, so trying again is safe. + for attempt in 1 2 3; do + gh release upload --clobber "$staged" "${assets[@]}" && break + [ "$attempt" -lt 3 ] || exit 1 + echo "upload failed; trying again (attempt $attempt of 3)" >&2 + sleep $((attempt * 10)) + done # Sizes, not just presence: an upload cut off partway still leaves a # named asset behind, and a truncated binary is the one outcome this diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 430518d08..0d6d1ccd7 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -240,7 +240,15 @@ jobs: gh release create "$staged" --draft --prerelease --latest=false \ --target "$GITHUB_SHA" --title "CodeTrial desktop (main)" \ --notes "Automated desktop build of ${GITHUB_SHA:0:7}. The installers are not signed yet; docs/desktop.md lists what that means on each platform." - gh release upload "$staged" "${assets[@]}" + # An upload can time out (HTTP 408) on the GitHub side with nothing + # wrong in the build. --clobber replaces an asset a cut-off attempt + # left behind, so trying again is safe. + for attempt in 1 2 3; do + gh release upload --clobber "$staged" "${assets[@]}" && break + [ "$attempt" -lt 3 ] || exit 1 + echo "upload failed; trying again (attempt $attempt of 3)" >&2 + sleep $((attempt * 10)) + done # Sizes, not just presence: a cut-off upload still leaves a named # asset behind.