You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[macOS] Added HTTP status code check to download_with_retries (actions#3716)
* Disable exit on error temporary to implement retry logic based on exit code
* Check HTTP response code and retry if it's not 200
* Make variables local to not interfere with other scripts
Co-authored-by: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com>
echo"Unable to download $URL, next attempt in $interval sec, $retries attempts left"
26
-
sleep $interval
27
-
else
28
-
echo"$URL was downloaded successfully to $DEST/$NAME"
23
+
# Temporary disable exit on error to retry on non-zero exit code
24
+
set +e
25
+
http_code=$(eval $COMMAND)
26
+
exit_code=$?
27
+
if [ $http_code-eq 200 ] && [ $exit_code-eq 0 ];then
28
+
echo"Download completed"
29
29
return 0
30
+
else
31
+
echo"Error — Either HTTP response code for '$URL' is wrong - '$http_code' or exit code is not 0 - '$exit_code'. Waiting $interval seconds before the next attempt, $retries attempts left"
0 commit comments