Skip to content

Commit 4581cab

Browse files
authored
Add retry logic to artifact download action (#10588)
# 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.
1 parent 9c73758 commit 4581cab

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

.github/actions/download-artifact-extract/action.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,45 @@ inputs:
2929
runs:
3030
using: "composite"
3131
steps:
32-
- name: Download artifact
32+
- name: Download artifact (attempt 1)
33+
id: download_attempt_1
34+
continue-on-error: true
35+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
36+
with:
37+
name: ${{ inputs.artifact-name }}
38+
github-token: ${{ inputs.gh-token }}
39+
run-id: ${{ inputs.run-id }}
40+
path: ${{ inputs.extract-path }}
41+
42+
- name: Wait before retry 1
43+
if: steps.download_attempt_1.outcome == 'failure'
3344
shell: bash
3445
run: |
35-
echo "::group::📦 Downloading ${{ inputs.artifact-name }}"
36-
echo "Artifact: ${{ inputs.artifact-name }}"
37-
echo "Run ID: ${{ inputs.run-id }}"
38-
echo "::endgroup::"
39-
40-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
46+
echo "::warning::Attempt 1 failed, retrying in 10s..."
47+
sleep 10
48+
49+
- name: Download artifact (attempt 2)
50+
id: download_attempt_2
51+
if: steps.download_attempt_1.outcome == 'failure'
52+
continue-on-error: true
53+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
54+
with:
55+
name: ${{ inputs.artifact-name }}
56+
github-token: ${{ inputs.gh-token }}
57+
run-id: ${{ inputs.run-id }}
58+
path: ${{ inputs.extract-path }}
59+
60+
- name: Wait before retry 2
61+
if: steps.download_attempt_2.outcome == 'failure'
62+
shell: bash
63+
run: |
64+
echo "::warning::Attempt 2 failed, retrying in 20s..."
65+
sleep 20
66+
67+
- name: Download artifact (attempt 3)
68+
id: download_attempt_3
69+
if: steps.download_attempt_2.outcome == 'failure'
70+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
4171
with:
4272
name: ${{ inputs.artifact-name }}
4373
github-token: ${{ inputs.gh-token }}

.github/workflows/zombienet_cumulus.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ jobs:
8080
- name: Checkout
8181
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8282

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

9091
- name: zombienet_test

0 commit comments

Comments
 (0)