From 918152bb27204549136c31afbc1d172e3134cdee Mon Sep 17 00:00:00 2001 From: "warp-agent-staging[bot]" <240773466+warp-agent-staging[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 19:56:15 +0000 Subject: [PATCH] Fail Sentry DIF uploads after bounded retries --- script/sentry_upload_dif.sh | 40 ++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/script/sentry_upload_dif.sh b/script/sentry_upload_dif.sh index b9bc5786db6..80e4b69b622 100755 --- a/script/sentry_upload_dif.sh +++ b/script/sentry_upload_dif.sh @@ -8,11 +8,37 @@ set -x -if which sentry-cli >/dev/null; then - ERROR="$(sentry-cli upload-dif "$DEBUG_FILE_OR_FOLDER_PATH")" - if [ ! $? -eq 0 ]; then - echo "warning: sentry-cli - $ERROR" - fi -else - echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases" +MAX_ATTEMPTS=3 +INITIAL_RETRY_DELAY_SECONDS=5 +MAX_RETRY_DELAY_SECONDS=10 + +if ! command -v sentry-cli >/dev/null; then + echo "::error title=Error uploading Sentry debug files::sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases" + exit 1 fi + +if [ ! -e "$DEBUG_FILE_OR_FOLDER_PATH" ]; then + echo "::error title=Error uploading Sentry debug files::DEBUG_FILE_OR_FOLDER_PATH '$DEBUG_FILE_OR_FOLDER_PATH' does not exist" + exit 1 +fi + +attempt=1 +retry_delay_seconds=$INITIAL_RETRY_DELAY_SECONDS +while true; do + if sentry-cli upload-dif "$DEBUG_FILE_OR_FOLDER_PATH"; then + echo "Sentry debug file upload succeeded on attempt $attempt/$MAX_ATTEMPTS." + exit 0 + fi + + if [ "$attempt" -ge "$MAX_ATTEMPTS" ]; then + echo "::error title=Error uploading Sentry debug files::sentry-cli upload-dif failed after $MAX_ATTEMPTS attempts" + exit 1 + fi + echo "::warning title=Sentry debug file upload failed::Attempt $attempt/$MAX_ATTEMPTS failed; retrying in ${retry_delay_seconds}s" + sleep "$retry_delay_seconds" + attempt=$((attempt + 1)) + retry_delay_seconds=$((retry_delay_seconds * 2)) + if [ "$retry_delay_seconds" -gt "$MAX_RETRY_DELAY_SECONDS" ]; then + retry_delay_seconds=$MAX_RETRY_DELAY_SECONDS + fi +done