KarmaGYZ commented on a change in pull request #10951: [FLINK-15701][Travis]
Retries when uploading to transfer.sh fails
URL: https://github.com/apache/flink/pull/10951#discussion_r370967049
##########
File path: tools/travis_watchdog.sh
##########
@@ -132,8 +135,23 @@ upload_artifacts_s3() {
fi
# upload to https://transfer.sh
- echo "Uploading to transfer.sh"
- curl --upload-file $ARTIFACTS_FILE --max-time 60 https://transfer.sh
+ echo "Uploading to transfer.sh, maximum retries is
${TRANSFER_UPLOAD_MAX_RETRIES}"
+ for i in $(seq 1 ${TRANSFER_UPLOAD_MAX_RETRIES});do
+ url_or_error=$(curl --upload-file $ARTIFACTS_FILE --max-time 60
https://transfer.sh)
+ echo ${url_or_error}
+
+ if grep -q "^http" <<< ${url_or_error};then
+ # Check if the uploaded file can be accessed
successfully
+ access_response=$(curl --max-time 60 -o /dev/null -w
"%{http_code}" -H "Accept: text/html" ${url_or_error} 2>/dev/null)
+ if [[ "$access_response" = "200" ]];then
+ break
+ fi
+ fi
+
+ if [[ "$i" -lt "$TRANSFER_UPLOAD_MAX_RETRIES" ]];then
+ echo "Failed to upload to transfer.sh and will retry..."
+ fi
+ done
Review comment:
Does the native "retry" mechanism of `curl` works here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services