forked from Lucent-Financial-Group/Zeta
-
Notifications
You must be signed in to change notification settings - Fork 0
install: unify curl-with-retry behaviour into shared helper (Aaron 2026-04-28) #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b8e5236
fix(install): unify curl-with-retry behaviour into shared helper
AceHack d1a4371
install: split curl-fetch into file + stream variants; fix command-su…
AceHack 9dba612
install: harden curl-fetch idempotence guard against caller-env colli…
AceHack cf85ea9
install: drop ZETA prefix from idempotence sentinel — internal-only, …
AceHack fcc447b
fix(shellcheck): suppress SC1091 at curl-fetch source sites — CI runs…
AceHack ef2e266
install: drop --retry from curl_fetch_stream entirely + capture-exit-…
AceHack 98962e0
fix(markdownlint): MD032 blank line before bullet list in B-0063
AceHack dfc2947
fix(pr-75): address Copilot review threads (3 form-1 fixes)
AceHack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # tools/setup/common/curl-fetch.sh — sourceable helper for | ||
| # fetching URLs with uniform retry behaviour during install. | ||
| # | ||
| # WHY | ||
| # === | ||
| # Aaron 2026-04-28: *"curl 502 pattern i mean why should a PR | ||
| # ever fail for this? our code does not handle the retries | ||
| # already?"* — exactly: external-infra failures (upstream | ||
| # package mirrors returning 5xx, transient curl-22 / network | ||
| # blips) should be absorbed by retry-with-backoff inside the | ||
| # install path, not kicked out to a workflow-rerun discipline. | ||
| # | ||
| # This file centralises the retry policy so every call site | ||
| # uses the same flags. Previously the policy was inlined in | ||
| # `tools/setup/common/verifiers.sh` and missing entirely from | ||
| # `linux.sh` (mise install), `macos.sh` (Homebrew install), | ||
| # and `elan.sh` (Lean toolchain install). Aaron 2026-04-28 | ||
| # follow-up: *"sounds like a common helper would help too | ||
| # rather than copy/paste."* | ||
| # | ||
| # USAGE | ||
| # ===== | ||
| # Source this file, then call `curl_fetch` with the same | ||
| # args you'd pass to curl. The function prepends the retry | ||
| # flags transparently: | ||
| # | ||
| # # shellcheck source=/dev/null | ||
| # source "$REPO_ROOT/tools/setup/common/curl-fetch.sh" | ||
| # curl_fetch https://mise.run | sh | ||
| # /bin/bash -c "$(curl_fetch https://example.com/install.sh)" | ||
|
AceHack marked this conversation as resolved.
Outdated
|
||
| # curl_fetch --output "$path" "$url" | ||
| # | ||
| # RETRY POLICY (rationale) | ||
| # ======================== | ||
| # --retry 5 — five attempts total. Empirically | ||
| # covers all transient upstream blips | ||
| # this install path has hit during | ||
| # 2026-04 sessions. | ||
| # --retry-delay 2 — 2-second base delay between retries. | ||
| # Short enough to not penalise CI when | ||
| # the retry succeeds; long enough to | ||
| # let upstream recover from a brief | ||
| # surge. | ||
| # --retry-all-errors — retry on ALL transient errors, | ||
| # including HTTP 4xx that curl | ||
| # would otherwise pass through. | ||
| # (Default `--retry` only retries on | ||
| # select transient errors; setup | ||
| # installers benefit from the broader | ||
| # surface.) | ||
| # -fsSL — original flags preserved: | ||
| # -f: fail on HTTP errors | ||
| # -s: silent (no progress meter) | ||
| # -S: show errors when silent | ||
| # -L: follow redirects | ||
| # | ||
| # IDEMPOTENCE | ||
| # =========== | ||
| # Repeated source of this file overwrites the function body | ||
| # (no append, no accumulation). Safe to source from multiple | ||
| # scripts within the same install run. | ||
|
AceHack marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Guard: only define once per shell to avoid noise on multi-source. | ||
| if ! declare -F curl_fetch >/dev/null 2>&1; then | ||
|
AceHack marked this conversation as resolved.
Outdated
|
||
|
|
||
| curl_fetch() { | ||
| curl -fsSL --retry 5 --retry-delay 2 --retry-all-errors "$@" | ||
|
AceHack marked this conversation as resolved.
|
||
| } | ||
|
|
||
| fi | ||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.