Skip to content

Commit 463aedc

Browse files
authored
Add retry option to curl commands in install script
1 parent e75f743 commit 463aedc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/scripts/install-and-build-with-sdk.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ find_latest_swift_version() {
125125
log "Fetching releases from swift.org API..."
126126

127127
local releases_json
128-
releases_json=$(curl -fsSL "${SWIFT_API_INSTALL_ROOT}/releases.json") || fatal "Failed to fetch Swift releases"
128+
releases_json=$(curl -fsSL --retry 3 "${SWIFT_API_INSTALL_ROOT}/releases.json") || fatal "Failed to fetch Swift releases"
129129

130130
# Find all releases that start with the minor version (e.g, "6.1")
131131
# Sort them and get the latest one
@@ -212,7 +212,7 @@ find_latest_sdk_snapshot() {
212212
log "Fetching development snapshots from swift.org API..."
213213

214214
local sdk_json
215-
sdk_json=$(curl -fsSL "${SWIFT_API_INSTALL_ROOT}/dev/${version}/${sdk_name}-sdk.json") || fatal "Failed to fetch ${sdk_name}-sdk development snapshots"
215+
sdk_json=$(curl -fsSL --retry 3 "${SWIFT_API_INSTALL_ROOT}/dev/${version}/${sdk_name}-sdk.json") || fatal "Failed to fetch ${sdk_name}-sdk development snapshots"
216216

217217
# Extract the snapshot tag from the "dir" field of the first (newest) element
218218
local snapshot_tag
@@ -400,16 +400,16 @@ download_and_verify() {
400400
local temp_sig="${output_file}.sig"
401401

402402
log "Downloading ${url}"
403-
curl -fsSL "$url" -o "$output_file"
403+
curl -fsSL --retry 3 "$url" -o "$output_file"
404404

405405
log "Downloading signature"
406-
curl -fsSL "$sig_url" -o "$temp_sig"
406+
curl -fsSL --retry 3 "$sig_url" -o "$temp_sig"
407407

408408
log "Setting up GPG for verification"
409409
local gnupghome
410410
gnupghome="$(mktemp -d)"
411411
export GNUPGHOME="$gnupghome"
412-
curl -fSsL https://swift.org/keys/all-keys.asc | zcat -f | gpg --import - >/dev/null 2>&1
412+
curl -fSsL --retry 3 https://swift.org/keys/all-keys.asc | zcat -f | gpg --import - >/dev/null 2>&1
413413

414414
log "Verifying signature"
415415
if gpg --batch --verify "$temp_sig" "$output_file" >/dev/null 2>&1; then

0 commit comments

Comments
 (0)