Skip to content

Commit 580ef30

Browse files
committed
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 <[email protected]>
1 parent 94e9af6 commit 580ef30

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

action/action.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,37 @@ runs:
7777
7878
FLUX_DOWNLOAD_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/"
7979
80-
curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"
81-
curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"
82-
80+
MAX_RETRIES=5
81+
RETRY_DELAY=5
82+
83+
for i in $(seq 1 $MAX_RETRIES); do
84+
echo "Downloading flux binary (attempt $i/$MAX_RETRIES)"
85+
if curl -fsSL -o "$DL_DIR/$FLUX_TARGET_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_TARGET_FILE"; then
86+
break
87+
fi
88+
if [ $i -lt $MAX_RETRIES ]; then
89+
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
90+
sleep $RETRY_DELAY
91+
else
92+
echo "Failed to download flux binary after $MAX_RETRIES attempts"
93+
exit 1
94+
fi
95+
done
96+
97+
for i in $(seq 1 $MAX_RETRIES); do
98+
echo "Downloading checksums file (attempt $i/$MAX_RETRIES)"
99+
if curl -fsSL -o "$DL_DIR/$FLUX_CHECKSUMS_FILE" "$FLUX_DOWNLOAD_URL/$FLUX_CHECKSUMS_FILE"; then
100+
break
101+
fi
102+
if [ $i -lt $MAX_RETRIES ]; then
103+
echo "Download failed, retrying in ${RETRY_DELAY} seconds..."
104+
sleep $RETRY_DELAY
105+
else
106+
echo "Failed to download checksums file after $MAX_RETRIES attempts"
107+
exit 1
108+
fi
109+
done
110+
83111
echo "Verifying checksum"
84112
sum=""
85113
if command -v openssl > /dev/null; then

0 commit comments

Comments
 (0)