Skip to content

Commit cb212d7

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Retry transient artifact download failures (#58841)
Summary: Pull Request resolved: #58841 GitHub-hosted runners intermittently fail `actions/download-artifact` before any transfer begins when the artifact service lookup hits a transient DNS error. The same `Failed to ListArtifacts: ENOTFOUND` signature has affected two iOS workflows on unrelated `main` commits, while sibling matrix jobs using the same artifacts completed successfully. Add a shared composite download action with three bounded attempts and 10-/20- second backoff, then use it in the two affected workflows. The first two failures remain visible as warnings, and the final attempt is not allowed to continue on error, so missing or persistently unavailable artifacts still fail the caller. No deterministic introducing commit was identified: the current head only changes C++ header includes, its Debug sibling passed all five downloads, and the same DNS signature previously appeared in the SwiftPM new-app workflow. Changelog: [Internal] Differential Revision: D123386956
1 parent 4e6bf24 commit cb212d7

3 files changed

Lines changed: 69 additions & 10 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Download artifact with retries
2+
description: Downloads an artifact, retrying transient failures up to two times
3+
4+
inputs:
5+
name:
6+
description: Artifact name
7+
required: true
8+
path:
9+
description: Destination path
10+
required: true
11+
12+
outputs:
13+
download-path:
14+
description: Absolute path where the artifact was downloaded
15+
value: ${{ steps.download-3.outputs.download-path || steps.download-2.outputs.download-path || steps.download-1.outputs.download-path }}
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Download artifact (attempt 1 of 3)
21+
id: download-1
22+
if: ${{ always() }}
23+
continue-on-error: true
24+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
25+
with:
26+
name: ${{ inputs.name }}
27+
path: ${{ inputs.path }}
28+
29+
- name: Wait before attempt 2
30+
if: ${{ always() && steps.download-1.outcome == 'failure' }}
31+
shell: bash
32+
run: |
33+
echo "::warning::Artifact download failed; retrying in 10 seconds"
34+
sleep 10
35+
36+
- name: Download artifact (attempt 2 of 3)
37+
id: download-2
38+
if: ${{ always() && steps.download-1.outcome == 'failure' }}
39+
continue-on-error: true
40+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
41+
with:
42+
name: ${{ inputs.name }}
43+
path: ${{ inputs.path }}
44+
45+
- name: Wait before attempt 3
46+
if: ${{ always() && steps.download-2.outcome == 'failure' }}
47+
shell: bash
48+
run: |
49+
echo "::warning::Artifact download failed again; retrying in 20 seconds"
50+
sleep 20
51+
52+
- name: Download artifact (attempt 3 of 3)
53+
id: download-3
54+
if: ${{ always() && steps.download-2.outcome == 'failure' }}
55+
# Deliberately do not continue on error: the last failure must fail the caller.
56+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
57+
with:
58+
name: ${{ inputs.name }}
59+
path: ${{ inputs.path }}

‎.github/workflows/e2e-ios-templateapp.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ jobs:
3333
with:
3434
ruby-version: 2.6.10
3535
- name: Download React Native Package
36-
uses: actions/download-artifact@v7
36+
uses: ./.github/actions/download-artifact
3737
with:
3838
name: react-native-package
3939
path: /tmp/react-native-tmp
4040
- name: Print /tmp folder
4141
run: ls -lR /tmp/react-native-tmp
4242
- name: Download ReactNativeDependencies
43-
uses: actions/download-artifact@v7
43+
uses: ./.github/actions/download-artifact
4444
with:
4545
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
4646
path: /tmp/third-party
4747
- name: Print third-party folder
4848
shell: bash
4949
run: ls -lR /tmp/third-party
5050
- name: Download React Native Prebuilds
51-
uses: actions/download-artifact@v7
51+
uses: ./.github/actions/download-artifact
5252
with:
5353
name: ReactCore${{ matrix.flavor }}.xcframework.tar.gz
5454
path: /tmp/ReactCore
@@ -114,15 +114,15 @@ jobs:
114114
- name: Run yarn
115115
uses: ./.github/actions/yarn-install
116116
- name: Download app
117-
uses: actions/download-artifact@v7
117+
uses: ./.github/actions/download-artifact
118118
with:
119119
name: RNTestProject-${{ matrix.flavor }}
120120
path: /tmp/RNTestProjectBuild/RNTestProject.app
121121
- name: Check downloaded folder content
122122
run: ls -l /tmp/RNTestProjectBuild/RNTestProject.app
123123
- name: Download React Native Package
124124
if: ${{ matrix.flavor == 'Debug' }}
125-
uses: actions/download-artifact@v7
125+
uses: ./.github/actions/download-artifact
126126
with:
127127
name: react-native-package
128128
path: /tmp/react-native-tmp

‎.github/workflows/test-ios-spm-newapp.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ jobs:
4040
# release/ artifact slots together (and `--download skip` refuses an
4141
# incomplete slot). Please don't "optimise" this down to one flavor.
4242
- name: Download ReactCore (Debug)
43-
uses: actions/download-artifact@v7
43+
uses: ./.github/actions/download-artifact
4444
with:
4545
name: ReactCoreDebug.xcframework.tar.gz
4646
path: /tmp/rc-debug
4747
- name: Download ReactCore (Release)
48-
uses: actions/download-artifact@v7
48+
uses: ./.github/actions/download-artifact
4949
with:
5050
name: ReactCoreRelease.xcframework.tar.gz
5151
path: /tmp/rc-release
5252
- name: Download ReactNativeDependencies (Debug)
53-
uses: actions/download-artifact@v7
53+
uses: ./.github/actions/download-artifact
5454
with:
5555
name: ReactNativeDependenciesDebug.xcframework.tar.gz
5656
path: /tmp/deps-debug
5757
- name: Download ReactNativeDependencies (Release)
58-
uses: actions/download-artifact@v7
58+
uses: ./.github/actions/download-artifact
5959
with:
6060
name: ReactNativeDependenciesRelease.xcframework.tar.gz
6161
path: /tmp/deps-release
6262
- name: Download React Native package
63-
uses: actions/download-artifact@v7
63+
uses: ./.github/actions/download-artifact
6464
with:
6565
name: react-native-package
6666
path: /tmp/react-native-tmp

0 commit comments

Comments
 (0)