Enable retries and connection timeouts when using curl
#1335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the shimmed CNBs used in
heroku/builder
we have been seeing quite a few transient errors related to buildpacks downloading from S3.Adding appropriate retries and connection timeouts to all of our buildpack's curl usages should help with these, as well as make builds more reliable in general for users on Heroku, plus also anyone using a shimmed CNB locally with Pack CLI (where the network connection may be even less reliable).
The
--retry-connrefused
option has been used since otherwise curl doesn't retry cases where the connection was refused. Ideally we would use--retry-all-errors
which takes that one step further, however that option was only added in curl 7.71, so is only supported by Heroku-22+.I've intentionally not added
--max-time
to usages within buildpack compile, since otherwise users running the buildpack locally on slow connections may permanently hit timeouts (and timeouts mid-download occur so rarely it's not worth the hassle of making this configurable).For more on curl options, see:
https://curl.se/docs/manpage.html
GUS-W-11283397.