Repository navigation
Build/Test Tools: Harden CI setup against flaky downloads #15210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
lucatume
wants to merge
11
commits into
WordPress:trunk
from
lucatume:fix/perf-tests-setup-hardening
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
01f1047
Build/Test Tools: Time out Playwright browser installs.
lucatume 70abfd9
Build/Test Tools: Retry the mock data download.
lucatume 30f2157
Build/Test Tools: Retry the WordPress Importer download.
lucatume 1987336
Build/Test Tools: Retry the baseline WordPress download.
lucatume 7a1529e
Build/Test Tools: Retry the npm install in Set up npm.
lucatume 96c2697
Build/Test Tools: Skip performance artifacts if tests never ran.
lucatume 9b1b332
Build/Test Tools: Retry the Gutenberg download in E2E tests.
lucatume a4ef556
Build/Test Tools: Retry WordPress downloads in install tests.
lucatume a099d52
Build/Test Tools: Move retries to shared actions
lucatume 9d53427
Build/Test Tools: Raise the mock data import cap
lucatume 931f161
Build/Test Tools: Retry stalled downloads
lucatume File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: 'Download with retry' | ||
| description: 'Downloads a file with curl, retrying on any error.' | ||
|
|
||
| inputs: | ||
| url: | ||
| description: 'The URL to download.' | ||
| required: true | ||
| output: | ||
| description: 'The path to save the file to, relative to the workspace.' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Download the file | ||
| shell: bash | ||
| # A stalled attempt (connecting for over 30 s, or under 1 KB/s for 30 s) fails and is | ||
| # retried: curl has no transfer timeout, and `timeout-minutes` would end the step unretried. | ||
| # No retry starts after 10 minutes, so a long `Retry-After` can't stretch the waits. | ||
| run: curl --fail --no-progress-meter --location --retry 5 --retry-all-errors --retry-max-time 600 --connect-timeout 30 --speed-limit 1024 --speed-time 30 --output "$OUTPUT" "$URL" | ||
| env: | ||
| URL: ${{ inputs.url }} | ||
| OUTPUT: ${{ inputs.output }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: 'Run with retry' | ||
| description: 'Runs a Bash command, retrying it when it fails. For downloads curl can retry itself, use download-with-retry.' | ||
|
|
||
| inputs: | ||
| command: | ||
| description: 'The Bash command to run. It runs as code: read values from the `env` of the calling step, not from expressions.' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Run the command | ||
| shell: bash | ||
| # Waits 10 s, then 20 s, between attempts, like `tools/local-env/scripts/utils.js`. | ||
| run: | | ||
| for (( attempt = 1; attempt <= MAX_ATTEMPTS; attempt++ )); do | ||
| if bash -eo pipefail -c "$COMMAND"; then | ||
| exit 0 | ||
| fi | ||
| echo "::warning::Command failed on attempt $attempt of $MAX_ATTEMPTS." | ||
| if (( attempt < MAX_ATTEMPTS )); then | ||
| sleep $(( attempt * 10 )) | ||
| fi | ||
| done | ||
| exit 1 | ||
| env: | ||
| COMMAND: ${{ inputs.command }} | ||
| MAX_ATTEMPTS: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.