Retry downloads in case of failure - #16
Conversation
a4b7d63 to
2b7a2e2
Compare
Curl will now retry the download up to 10 times or 2 minutes.
2b7a2e2 to
d86f6f8
Compare
There was a problem hiding this comment.
Pull request overview
This PR enhances the reliability of the crane installation process by adding retry logic to the download step. The changes prevent transient network failures from breaking the setup action by allowing curl to retry up to 10 times within a 2-minute window.
Key Changes
- Extracted the download URL to a separate variable for clarity
- Added retry flags (
--retry 10,--retry-max-time 120) and--remove-on-errorto the curl command - Modified the download to save to an intermediate file (
out.tar.gz) instead of piping directly to tar
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| curl -fsL \ | ||
| --remove-on-error --retry 10 --retry-max-time 120 \ | ||
| -o out.tar.gz ${url} || exit 1 | ||
| tar xz -f out.tar.gz ${out} |
There was a problem hiding this comment.
The tar command syntax is incorrect. The correct syntax for GNU tar is tar xzf out.tar.gz ${out} (no space between flags and argument) or tar -xzf out.tar.gz ${out} (with hyphens). The current syntax tar xz -f out.tar.gz ${out} will not work correctly because xz is treated as separate options and then -f is a separate option.
| tar xz -f out.tar.gz ${out} | |
| tar xzf out.tar.gz ${out} |
| --remove-on-error --retry 10 --retry-max-time 120 \ | ||
| -o out.tar.gz ${url} || exit 1 |
There was a problem hiding this comment.
The --remove-on-error flag is not available in older versions of curl (it was added in curl 7.83.0, released in April 2022). Consider verifying that the GitHub Actions runners have a compatible curl version, or provide a fallback mechanism. Alternatively, you could manually remove the file on error: curl -fsL --retry 10 --retry-max-time 120 -o out.tar.gz ${url} || { rm -f out.tar.gz; exit 1; }
| --remove-on-error --retry 10 --retry-max-time 120 \ | |
| -o out.tar.gz ${url} || exit 1 | |
| --retry 10 --retry-max-time 120 \ | |
| -o out.tar.gz ${url} || { rm -f out.tar.gz; exit 1; } |
|
superceded by #17 |
Curl will now retry the download up to 10 times or 2 minutes.