Add retry logic to artifact download action#10588
Conversation
90e91ad to
4921578
Compare
|
Hi @DenzelPenzel, I think we can still use the download-artifact action with a fixed number of retries. Since, I don't think we want more. than 3 retries. Maybe we can add 3 download steps and make the last two conditional run. wdyt? |
Yes, update to conditional steps, because gh cli by default not available on some runners |
4921578 to
7f00dbd
Compare
lrubasze
left a comment
There was a problem hiding this comment.
LGTM with some improvement ideas :)
| using: "composite" | ||
| steps: | ||
| - name: Download artifact | ||
| - name: Download artifact (attempt 1) |
There was a problem hiding this comment.
Just thinking that maybe we could use shell script with some loop?
Eg. Something like this with
- name: Download artifact with retry
shell: bash
run: |
max_attempts=3
attempt=1
backoff=2
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt of $max_attempts"
if gh run download ${{ inputs.run-id }} \
--name ${{ inputs.artifact-name }} \
--dir ${{ inputs.extract-path }}; then
echo "✓ Download succeeded"
break
fi
if [ $attempt -eq $max_attempts ]; then
echo "✗ All attempts failed"
exit 1
fi
sleep_time=$((backoff ** (attempt - 1)))
echo "Retrying in ${sleep_time}s..."
sleep $sleep_time
attempt=$((attempt + 1))
done
Alternatively we could try to use GH retry action, eg. https://github.com/marketplace/actions/retry-step
Or just merge it and add some improvements separately :)
There was a problem hiding this comment.
AFAIR the retry-step only works with run commands so it's not applicable in case of the actions/download-artifact action
lrubasze
left a comment
There was a problem hiding this comment.
LGTM with minor comment
…ry-artifact-download # Conflicts: # .github/workflows/zombienet_cumulus.yml
7916527 to
91e1f1c
Compare
pepoviola
left a comment
There was a problem hiding this comment.
Looks good, I think the 3 steps are ok and we can revisit if needed in the future.
Thx!
Description
Add retry logic (3 attempts with exponential backoff) to
download-artifact-extractaction using conditional steps. Updatezombienet_cumulusworkflow to use the custom action for consistent retry behavior.