Skip to content

Add retry logic to artifact download action#10588

Merged
pepoviola merged 2 commits intomasterfrom
zombienet-tests-retry-artifact-download
Dec 16, 2025
Merged

Add retry logic to artifact download action#10588
pepoviola merged 2 commits intomasterfrom
zombienet-tests-retry-artifact-download

Conversation

@DenzelPenzel
Copy link
Copy Markdown
Contributor

@DenzelPenzel DenzelPenzel commented Dec 9, 2025

Description

Add retry logic (3 attempts with exponential backoff) to download-artifact-extract action using conditional steps. Update zombienet_cumulus workflow to use the custom action for consistent retry behavior.

@DenzelPenzel DenzelPenzel requested review from a team as code owners December 9, 2025 23:20
@DenzelPenzel DenzelPenzel force-pushed the zombienet-tests-retry-artifact-download branch 2 times, most recently from 90e91ad to 4921578 Compare December 9, 2025 23:22
@DenzelPenzel DenzelPenzel self-assigned this Dec 9, 2025
@paritytech-review-bot paritytech-review-bot Bot requested a review from a team December 10, 2025 08:19
@pepoviola
Copy link
Copy Markdown
Contributor

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?

@DenzelPenzel
Copy link
Copy Markdown
Contributor Author

DenzelPenzel commented Dec 10, 2025

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

@DenzelPenzel DenzelPenzel force-pushed the zombienet-tests-retry-artifact-download branch from 4921578 to 7f00dbd Compare December 10, 2025 10:28
@DenzelPenzel DenzelPenzel added T10-tests This PR/Issue is related to tests. R0-no-crate-publish-required The change does not require any crates to be re-published. labels Dec 10, 2025
Copy link
Copy Markdown
Contributor

@lrubasze lrubasze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some improvement ideas :)

using: "composite"
steps:
- name: Download artifact
- name: Download artifact (attempt 1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIR the retry-step only works with run commands so it's not applicable in case of the actions/download-artifact action

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing :)

@paritytech-review-bot paritytech-review-bot Bot requested a review from a team December 16, 2025 08:19
Copy link
Copy Markdown
Contributor

@lrubasze lrubasze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comment

Comment thread .github/actions/download-artifact-extract/action.yml Outdated
Comment thread .github/actions/download-artifact-extract/action.yml Outdated
…ry-artifact-download

# Conflicts:
#	.github/workflows/zombienet_cumulus.yml
@DenzelPenzel DenzelPenzel force-pushed the zombienet-tests-retry-artifact-download branch from 7916527 to 91e1f1c Compare December 16, 2025 17:38
Copy link
Copy Markdown
Contributor

@pepoviola pepoviola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I think the 3 steps are ok and we can revisit if needed in the future.
Thx!

@pepoviola pepoviola enabled auto-merge December 16, 2025 17:45
@pepoviola pepoviola added this pull request to the merge queue Dec 16, 2025
Merged via the queue into master with commit 4581cab Dec 16, 2025
242 of 247 checks passed
@pepoviola pepoviola deleted the zombienet-tests-retry-artifact-download branch December 16, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published. T10-tests This PR/Issue is related to tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants