File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 - ubuntu-latest
2828 - ubuntu-22.04
2929 - macos-latest
30- - macos-13 # Intel-based macOS
3130 - windows-latest
3231 steps :
3332 - name : Checkout code
Original file line number Diff line number Diff line change @@ -196,15 +196,27 @@ if [ -f "$BINARY_PATH" ]; then
196196 print_warning " Binary '$BINARY_PATH ' already exists. It will be overwritten."
197197fi
198198
199- # Download the binary
199+ # Download the binary with retry logic
200200print_info " Downloading gh-aw binary..."
201- if curl -L -f -o " $BINARY_PATH " " $DOWNLOAD_URL " ; then
202- print_success " Binary downloaded successfully"
203- else
204- print_error " Failed to download binary from $DOWNLOAD_URL "
205- print_info " Please check if the version and platform combination exists in the releases."
206- exit 1
207- fi
201+ MAX_RETRIES=3
202+ RETRY_DELAY=2
203+
204+ for attempt in $( seq 1 $MAX_RETRIES ) ; do
205+ if curl -L -f -o " $BINARY_PATH " " $DOWNLOAD_URL " ; then
206+ print_success " Binary downloaded successfully"
207+ break
208+ else
209+ if [ $attempt -eq $MAX_RETRIES ]; then
210+ print_error " Failed to download binary from $DOWNLOAD_URL after $MAX_RETRIES attempts"
211+ print_info " Please check if the version and platform combination exists in the releases."
212+ exit 1
213+ else
214+ print_warning " Download attempt $attempt failed. Retrying in ${RETRY_DELAY} s..."
215+ sleep $RETRY_DELAY
216+ RETRY_DELAY=$(( RETRY_DELAY * 2 ))
217+ fi
218+ fi
219+ done
208220
209221# Make it executable
210222print_info " Making binary executable..."
Original file line number Diff line number Diff line change @@ -232,5 +232,33 @@ else
232232 exit 1
233233fi
234234
235+ # Test 9: Verify retry logic for downloads
236+ echo " "
237+ echo " Test 9: Verify download retry logic"
238+
239+ # Check for MAX_RETRIES variable
240+ if grep -q " MAX_RETRIES=" " $PROJECT_ROOT /install-gh-aw.sh" ; then
241+ echo " ✓ PASS: MAX_RETRIES variable exists"
242+ else
243+ echo " ✗ FAIL: MAX_RETRIES variable not found"
244+ exit 1
245+ fi
246+
247+ # Check for retry loop
248+ if grep -q " for attempt in" " $PROJECT_ROOT /install-gh-aw.sh" ; then
249+ echo " ✓ PASS: Retry loop exists"
250+ else
251+ echo " ✗ FAIL: Retry loop not found"
252+ exit 1
253+ fi
254+
255+ # Check for exponential backoff
256+ if grep -q " RETRY_DELAY=\$ ((RETRY_DELAY \* 2))" " $PROJECT_ROOT /install-gh-aw.sh" ; then
257+ echo " ✓ PASS: Exponential backoff implemented"
258+ else
259+ echo " ✗ FAIL: Exponential backoff not found"
260+ exit 1
261+ fi
262+
235263echo " "
236264echo " === All tests passed ==="
You can’t perform that action at this time.
0 commit comments