From a2adddb4b7da78296ebf29749d94590280eb3b9b Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:06:13 +0100 Subject: [PATCH] ci: retry a failed source map upload before failing the build --- scripts/upload-sourcemaps.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/upload-sourcemaps.sh b/scripts/upload-sourcemaps.sh index 5c0c35976..313f3c897 100755 --- a/scripts/upload-sourcemaps.sh +++ b/scripts/upload-sourcemaps.sh @@ -24,7 +24,19 @@ fi url="${BUGSINK_URL:-https://bugsink.internal.bulwarkmail.org/}" cli="@sentry/cli@${SENTRY_CLI_VERSION:-3.8.2}" +# Release builds upload in parallel and Bugsink sometimes answers one with a +# 500, so each project gets three tries before the build fails. for project in ${BUGSINK_PROJECTS:-bulwark-instances bulwark-telemetry}; do - SENTRY_AUTH_TOKEN="$BUGSINK_AUTH_TOKEN" npx --yes "$cli" --url "$url" \ - sourcemaps --org bugsinkhasnoorgs --project "$project" upload "$dir" + for attempt in 1 2 3; do + if SENTRY_AUTH_TOKEN="$BUGSINK_AUTH_TOKEN" npx --yes "$cli" --url "$url" \ + sourcemaps --org bugsinkhasnoorgs --project "$project" upload "$dir"; then + break + fi + if [ "$attempt" = 3 ]; then + echo "::error::uploading source maps to ${project} failed 3 times" + exit 1 + fi + echo "::warning::uploading source maps to ${project} failed, trying again in $((attempt * 15)) s" + sleep $((attempt * 15)) + done done