Skip to content

Commit 09f3faf

Browse files
committed
ci: stage download-wheels retries under RUNNER_TEMP
The runner empties RUNNER_TEMP at the start and end of every job, so a staging directory left behind by a killed or cancelled step is still cleaned up. Falls back to /tmp outside GitHub Actions.
1 parent 405f392 commit 09f3faf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎ci/tools/download-wheels‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ set -euo pipefail
1515
# Downloads into a private staging directory and promotes the artifacts to CWD
1616
# on success. The staging directory is wiped before each retry so that
1717
# artifact directories left behind by a partial download do not cause gh to
18-
# refuse to re-download them on subsequent attempts.
18+
# refuse to re-download them on subsequent attempts. Staging lives under
19+
# RUNNER_TEMP, which the runner empties at the start and end of every job, so
20+
# a killed or cancelled step cannot leak it.
1921
_retry_gh_run_download() {
2022
local max_attempts=5
2123
local delay=15
2224
local max_delay=120
2325
local attempt=1
2426
local staging
25-
staging=$(mktemp -d)
27+
staging=$(mktemp -d -p "${RUNNER_TEMP:-/tmp}")
2628

2729
until gh run download "$@" -D "${staging}"; do
2830
rm -rf "${staging}"
@@ -34,7 +36,7 @@ _retry_gh_run_download() {
3436
sleep "${delay}"
3537
attempt=$(( attempt + 1 ))
3638
(( delay = delay * 2 > max_delay ? max_delay : delay * 2 ))
37-
staging=$(mktemp -d)
39+
staging=$(mktemp -d -p "${RUNNER_TEMP:-/tmp}")
3840
done
3941

4042
# Promote each downloaded artifact directory into the caller's CWD.

0 commit comments

Comments
 (0)