From 4d36d69d359ead5d97eef77c00abf8f3fce1d54e Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Thu, 3 Dec 2026 14:55:34 -0800 Subject: [PATCH] CI: log sccache download retries and bound each attempt Address the review on #3670: report each failed attempt as a warning with curl's exit code, fail with an ::error:: and that exit code after the last attempt, and add --connect-timeout/--max-time so a stalled connection fails into the retry loop instead of hanging until the job timeout. Both flags work with curl 7.61 in manylinux_2_28. --- .github/actions/install-sccache/action.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/install-sccache/action.yml b/.github/actions/install-sccache/action.yml index c719f5729a9..509d59dae41 100644 --- a/.github/actions/install-sccache/action.yml +++ b/.github/actions/install-sccache/action.yml @@ -86,9 +86,17 @@ runs: # Release downloads fail transiently (e.g. HTTP 618, which `curl --retry` skips); # manylinux_2_28's curl 7.61 lacks --retry-all-errors, so retry in the shell. for attempt in 1 2 3 4 5; do - curl -fsSL -o "${tmp_dir}/${tarball}" "${url}" && break - [[ "${attempt}" -lt 5 ]] || exit 1 - sleep 10 + rc=0 + curl -fsSL --connect-timeout 30 --max-time 300 -o "${tmp_dir}/${tarball}" "${url}" || rc=$? + if [[ "${rc}" -eq 0 ]]; then + break + elif [[ "${attempt}" -lt 5 ]]; then + echo "::warning::sccache download failed (attempt ${attempt}, curl exit ${rc}); retrying in 10s" + sleep 10 + else + echo "::error::sccache download failed after ${attempt} attempts (curl exit ${rc}): ${url}" + exit "${rc}" + fi done ( cd "${tmp_dir}"