Skip to content

stash/restore: add retry-count and fail-on-download inputs#715

Closed
potiuk wants to merge 1 commit intoapache:mainfrom
potiuk:stash-restore-retry-download
Closed

stash/restore: add retry-count and fail-on-download inputs#715
potiuk wants to merge 1 commit intoapache:mainfrom
potiuk:stash-restore-retry-download

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 14, 2026

Summary

  • Add retry-count input (default 3) to stash/restore/action.yml. When gh run download exits with code 1 (the transient failure mode observed for artifact downloads), the download is retried up to retry-count times. Other exit codes are not retried.
  • Add fail-on-download input (default false). When true, the step fails if the stash artifact was found but could not be downloaded after exhausting retries. When false, the failure is reported only via the stash-hit output.
  • Harden the Download Stash script against set -eo pipefail (the default GitHub Actions bash shell): call set +e up front so a single failing command cannot abort the step, and handle exit codes explicitly via $?.
  • Fix the previous || download="failed" && download="success" one-liner, which due to ||/&& precedence always reported success regardless of whether the download actually worked.

Test plan

  • Trigger a workflow that uses stash/restore against a valid stash and confirm the artifact is downloaded on the first attempt and stash-hit is true.
  • Simulate a transient gh run download failure (exit 1) and confirm the action retries up to retry-count times.
  • Run with fail-on-download: true against a known-broken download and confirm the step fails with the error annotation.
  • Run with fail-on-download: false (default) against a known-broken download and confirm the step succeeds with stash-hit=false.

Generated-by: Claude Opus 4.6 (1M context)

Add retry-count input (default 3) that retries `gh run download` when it
exits with code 1, and fail-on-download input (default false) that makes
the step fail when the download did not succeed. Also disable errexit in
the Download Stash script so a single failing command cannot abort the
step, and fix the previous `|| download=failed && download=success`
one-liner that always reported success regardless of the download result.
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 14, 2026

will open it from main repo to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant