From df7f10063743d490c9c21131ed50270cb8144803 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 21 Mar 2023 05:00:46 +0300 Subject: [PATCH] scripts: continious_upload: retry if upload failed --- scripts/continious_upload.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/continious_upload.sh b/scripts/continious_upload.sh index fb91611b91..d08971fac9 100755 --- a/scripts/continious_upload.sh +++ b/scripts/continious_upload.sh @@ -263,12 +263,21 @@ urlencode() { for FILE in "$@" ; do FULLNAME="${FILE}" BASENAME="$(basename "${FILE}")" - curl -H "Authorization: token ${GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/octet-stream" \ - --data-binary "@$FULLNAME" \ - "$upload_url?name=$(urlencode "$BASENAME")" - echo "" + + for retries in {1..25}; do + echo "Upload attempt $retries" + + if curl -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$FULLNAME" \ + "$upload_url?name=$(urlencode "$BASENAME")"; then + break + fi + + sleep 5s + echo "" + done done $shatool "$@"