fix(swagger-ui-build): harden curl download against transient CDN failures#1541
Open
dmitry-tokarev-nv wants to merge 1 commit intojuhaku:masterfrom
Open
fix(swagger-ui-build): harden curl download against transient CDN failures#1541dmitry-tokarev-nv wants to merge 1 commit intojuhaku:masterfrom
dmitry-tokarev-nv wants to merge 1 commit intojuhaku:masterfrom
Conversation
…lures
The build script downloads the Swagger UI archive at compile time using
`curl -sSL -o file URL`. Without `--fail`, curl exits 0 on HTTP 4xx/5xx
and writes the error response body to the output path. The build then
proceeds to `ZipArchive::new`, which panics with the cryptic message
"Could not find EOCD" — leaving the user to figure out that the real
problem was a transient CDN error, not a malformed local archive.
This has been observed in CI when the GitHub Releases CDN serves a
sustained 5xx for the swagger-ui release tarball. Add:
--fail / --show-error surface HTTP errors with a clear message
--retry 5 --retry-delay 2 ride out transient 5xx and connection
errors
--connect-timeout 10
--max-time 120 bound a stuck download so it can't hang
the build indefinitely
The flags used are supported on every curl release in current LTS
distros and on the curl.exe shipped via the Windows curl installer.
Signed-off-by: Dmitry Tokarev <dtokarev@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
utoipa-swagger-ui/build.rsdownloads the Swagger UI archive at compile time usingcurl -sSL -o file URL. Without--fail, curl exits 0 on HTTP 4xx/5xx and writes the error response body to the output path. The build then hitsZipArchive::new, which panics with"Could not find EOCD"— leaving the user to figure out that the actual problem was a transient CDN error, not a malformed local archive.We hit this in our CI when the GitHub Releases CDN started serving sustained 5xx for the swagger-ui release tarball. Job logs showed:
Change
Add the standard set of curl resilience flags to the
download_file_curlinvocation:--fail--show-error--retry 5--retry-delay 2--connect-timeout 10--max-time 120All flags are present in every modern curl, including the
curl.exeshipped via the Windows curl installer.Notes