mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-07 16:27:27 +00:00
Added retry logic to install.sh
What Changed: - Downloads now retry up to 5 times with 5-second delays between attempts - Applied to both the Flux binary and checksums file downloads - Clear feedback on retry attempts and failures Why This Matters - Improves Reliability: Network hiccups, rate limiting, or temporary outages no longer cause immediate failures. The action automatically recovers from transient issues. Signed-off-by: ivan-munteanu <148127170+ivan-munteanu@users.noreply.github.com>
This commit is contained in:
parent
94e9af6b2a
commit
580ef30c8f
1 changed files with 31 additions and 3 deletions
|
|
@ -77,8 +77,36 @@ runs:
|
||||||
|
|
||||||
FLUX_DOWNLOAD_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/"
|
FLUX_DOWNLOAD_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/"
|
||||||
|
|
||||||
curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"
|
MAX_RETRIES=5
|
||||||
curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"
|
RETRY_DELAY=5
|
||||||
|
|
||||||
|
for i in $(seq 1 $MAX_RETRIES); do
|
||||||
|
echo "Downloading flux binary (attempt $i/$MAX_RETRIES)"
|
||||||
|
if curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ $i -lt $MAX_RETRIES ]; then
|
||||||
|
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
|
||||||
|
sleep $RETRY_DELAY
|
||||||
|
else
|
||||||
|
echo "Failed to download flux binary after $MAX_RETRIES attempts"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $(seq 1 $MAX_RETRIES); do
|
||||||
|
echo "Downloading checksums file (attempt $i/$MAX_RETRIES)"
|
||||||
|
if curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ $i -lt $MAX_RETRIES ]; then
|
||||||
|
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
|
||||||
|
sleep $RETRY_DELAY
|
||||||
|
else
|
||||||
|
echo "Failed to download checksums file after $MAX_RETRIES attempts"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "Verifying checksum"
|
echo "Verifying checksum"
|
||||||
sum=""
|
sum=""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue