Repository navigation
Fix: Retry the artefact download - #296
ModeSevenIndustrialSolutions merged 3 commits into
Conversation
GitHub's artefact service can fail to list an artefact for a few seconds after its upload, so the action's single download step misses when it runs in the job that uploaded the artefact. Add tests reading the download chain out of action.yaml: five attempts, each later one gated on the failure of the one before, a wait of 2, 4, 8 and 16 seconds between them, a last attempt that fails the action, and a report naming the artefact and the attempt count. The tests that need the retry are marked strict xfail. The artefact name guard and dependency cache tests now find the download attempts by their pinned action rather than by one step name, so they hold for one attempt or several. Issue lfreleng-actions#295 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
GitHub's artefact service can fail to list an artefact for a second or two after its upload, so a download that follows an upload in the same job often failed although the artefact existed. Repeat the download step: five attempts, with waits of 2, 4, 8 and 16 seconds between them, the figures pypi-publish-action uses for the same fault. Each attempt after the first, and each wait, runs only when the attempt before it failed, so a download that succeeds at once behaves as before. Any failure is retried, since artefact_path may hold files before the download and a miss cannot be told from another failure here. Only the last attempt lacks continue-on-error, so its failure fails the action and every later step is skipped; wheels already in artefact_path are never audited in place of the artefact. A report step then names the artefact and the number of attempts. Issue lfreleng-actions#295 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add two jobs. One runs the action with an artefact_name nothing uploaded and checks that it failed only after the 30 seconds of waits between its five download attempts, and that setup-python, the install step and the audit did not run after the failed download. The other runs tests/test_download_retry.py. The jobs that build or upload and then audit in one job stay as they are: they exercise the real lookup lag the retry exists for. Issue lfreleng-actions#295 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change addressing transient artefact-download failures with bounded retries.
No open issues 🎉
What changed in this PR
Adds bounded retries to the Python audit action’s artefact download, addressing temporary lookup failures when an upload and download occur in the same job.
Changes:
- Adds up to five download attempts with 2, 4, 8 and 16-second waits, preserving the existing artefact inputs and action pin.
- Reports exhausted retries and prevents downstream setup, installation and auditing after final failure.
- Documents the retry policy and adds regression and workflow coverage.
| File | Description |
|---|---|
tests/test_download_retry.py |
Adds checks for retry conditions, delays, failure reporting and downstream gating. |
tests/test_dependency_cache.py |
Checks that every download attempt precedes cache-key computation. |
tests/test_artefact_name_guard.py |
Extends name and guard checks to all download attempts. |
README.md |
Documents retry timing and final-failure behavior. |
action.yaml |
Implements five download attempts, waits and final-failure reporting. |
.github/workflows/testing.yaml |
Adds exhausted-retry integration coverage and a retry unit-test job. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.
The retry chain appears sound: retries stop after success, and exhausting all five attempts fails the action before installation or auditing. No actionable defects found in the diff or dependent code.
Antagonistic round 1 of 3.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
8d65799
into
lfreleng-actions:main
Closes #295
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLIc898f835e0bbe77ea03a150da99e7b54535c4beduv run --locked python -m pytest tests -q (at test commit, 3 xfailed)prek run --files tests/test_download_retry.py tests/test_artefact_name_guard.py tests/test_dependency_cache.pyprek run --files action.yaml README.md tests/test_download_retry.pyprek run --files action.yaml README.md tests/test_download_retry.pyprek run --files .github/workflows/testing.yamluv run --locked python -m pytest tests -quvx zizmor --persona=auditor --offline .github/workflows/testing.yaml action.yamlAISLOP_NO_TELEMETRY=1 prek run --files .github/workflows/testing.yaml README.md action.yaml tests/test_artefact_name_guard.py tests/test_dependency_cache.py tests/test_download_retry.pyThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.
GitHub's artefact service can fail to list an artefact for a second or two after its upload, so the action's single
actions/download-artifactstep missed whenever it followed an upload in the same job, although the artefact existed.What changed
action.yaml: the download is now a chain of five attempts (download_1…download_5), with wait steps of 2, 4, 8 and 16 seconds between them, thirty seconds in all. These are the figures Fix: Retry the artefact download by name pypi-publish-action#242 uses, as the issue comment asks. Each later attempt, and each wait, runs only whensteps.download_<n-1>.outcome == 'failure', so a download that succeeds at once runs exactly as before and adds no wait. Every failure is retried, sinceartefact_pathmay already hold files and a miss cannot be told from another failure. Attempts 1–4 carrycontinue-on-error: true. The last attempt does not, so its failure fails the action and every later step, which runs on the implicitsuccess(), is skipped. AReport artefact download failurestep (failure() && steps.download_5.outcome == 'failure') then logs::error::Artefact <name> not downloaded after 5 attemptsand exits 1. The artefact name expression,artefact_path, theCheck artefact nameguard and the pinned download-artifact commit are unchanged.README.md: the artefact name section now describes the retry.tests/test_download_retry.pyreads the chain out ofaction.yaml. It checks the attempt count, the gating on the previous attempt's outcome, that the waits sit between attempts, and that only the last attempt lackscontinue-on-error. It runs the wait and report scripts against a stubsleep, and checks that no step after the download uses a status function. These tests landed first, marked strict xfail.tests/test_artefact_name_guard.pyandtests/test_dependency_cache.pynow find the download attempts by their pinneduses:instead of by one step name..github/workflows/testing.yaml: one new job runs the action with anartefact_namethat nothing uploaded. It checks that the action failed, that at least 30 s passed (so it stopped only after the last attempt), and that no later step ran:pythonLocationis unchanged (setup-python did not run), the install venv does not exist andaudit_outcomeisskipped. A second new job runs the new pytest module. The existing jobs that build and audit in one job are unchanged.Checks run
uv run --locked python -m pytest tests -q: 67 passed. At the test commit: 64 passed, 3 xfailed.prek run --files <all changed files>: every hook passed, aislop included, withAISLOP_NO_TELEMETRY=1.zizmor --persona=auditor --offline action.yaml .github/workflows/testing.yaml(v1.33.1): no findings.For reviewers
Unable to download artifact(s)error annotation from each missed attempt, becausecontinue-on-errordoes not suppress annotations.failure()inside a composite action. If that check ever evaluated false, the action would still fail, because the last attempt has nocontinue-on-error. Only the summary error line would be lost.Run Tests 🧪andTest Custom Artefact Nameare the jobs that show it on this PR.