Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions .github/actions/download-artifact-extract/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,45 @@ inputs:
runs:
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 :)

id: download_attempt_1
continue-on-error: true
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.artifact-name }}
github-token: ${{ inputs.gh-token }}
run-id: ${{ inputs.run-id }}
path: ${{ inputs.extract-path }}

- name: Wait before retry 1
if: steps.download_attempt_1.outcome == 'failure'
shell: bash
run: |
echo "::group::📦 Downloading ${{ inputs.artifact-name }}"
echo "Artifact: ${{ inputs.artifact-name }}"
echo "Run ID: ${{ inputs.run-id }}"
echo "::endgroup::"

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
echo "::warning::Attempt 1 failed, retrying in 10s..."
sleep 10

- name: Download artifact (attempt 2)
id: download_attempt_2
if: steps.download_attempt_1.outcome == 'failure'
continue-on-error: true
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.artifact-name }}
github-token: ${{ inputs.gh-token }}
run-id: ${{ inputs.run-id }}
path: ${{ inputs.extract-path }}

- name: Wait before retry 2
if: steps.download_attempt_2.outcome == 'failure'
shell: bash
run: |
echo "::warning::Attempt 2 failed, retrying in 20s..."
sleep 20

- name: Download artifact (attempt 3)
id: download_attempt_3
if: steps.download_attempt_2.outcome == 'failure'
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.artifact-name }}
github-token: ${{ inputs.gh-token }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/zombienet_cumulus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ jobs:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
- name: Download test parachain artifact
if: ${{ matrix.test.needs-wasm-binary }}
uses: ./.github/actions/download-artifact-extract
with:
name: build-test-parachain-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
github-token: ${{ secrets.GITHUB_TOKEN }}
artifact-name: build-test-parachain-${{ needs.preflight.outputs.SOURCE_REF_SLUG }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ needs.preflight.outputs.BUILD_RUN_ID }}

- name: zombienet_test
Expand Down
Loading