diff --git a/tools/rapids-install-sccache b/tools/rapids-install-sccache index f699dff..ee42e8a 100755 --- a/tools/rapids-install-sccache +++ b/tools/rapids-install-sccache @@ -12,36 +12,17 @@ if test "$SCCACHE_VERSION" = rapids; then SCCACHE_REPO="rapidsai/sccache" fi -ATTEMPTS=0 -while [ "${SCCACHE_VERSION:-latest}" = latest ]; do - SCCACHE_VERSION="$(wget --no-hsts -q -O- "https://api.github.com/repos/${SCCACHE_REPO}/releases/latest" | jq -r '.tag_name | sub("^v"; "")')" - if test -n "${SCCACHE_VERSION:+x}"; then - break - elif test "$((ATTEMPTS++))" -lt 10; then - echo "(!) Failed to load latest ${SCCACHE_REPO} version. Retrying (${ATTEMPTS}/10)..." >&2 - SCCACHE_VERSION="latest" - sleep 10 - else - echo "(!) Failed to retrieve latest sccache version after 10 attempts." >&2 - exit 1 - fi -done +rapids-prompt-local-github-auth + +if [ "${SCCACHE_VERSION:-latest}" = latest ]; then + SCCACHE_VERSION="$(rapids-retry --quiet gh release view --repo "${SCCACHE_REPO}" --json tagName --jq '.tagName | sub("^v"; "")')" +fi if [ -n "${CURRENT_SCCACHE_VERSION##"${SCCACHE_VERSION}"}" ]; then echo "Downloading sccache v${SCCACHE_VERSION}..." >&2 - ATTEMPTS=0 - # Install sccache to $SCCACHE_BIN_DIR - while ! wget --no-hsts -q -O- "https://github.com/${SCCACHE_REPO}/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-$(uname -m)-unknown-linux-musl.tar.gz" \ - | tar -C "$SCCACHE_BIN_DIR" -zf - --overwrite --wildcards --strip-components=1 -x '*/sccache'; do - if test "$((ATTEMPTS++))" -lt 10; then - echo "(!) Failed to download sccache v${SCCACHE_VERSION}. Retrying (${ATTEMPTS}/10)..." >&2 - sleep 10 - else - echo "(!) Failed to download sccache v${SCCACHE_VERSION} after 10 attempts." >&2 - exit 1 - fi - done - # Verify installation + SCCACHE_ASSET="sccache-v${SCCACHE_VERSION}-$(uname -m)-unknown-linux-musl.tar.gz" + rapids-retry gh release download "v${SCCACHE_VERSION}" --repo "${SCCACHE_REPO}" --pattern "${SCCACHE_ASSET}" --output - \ + | tar -C "$SCCACHE_BIN_DIR" -zf - --overwrite --wildcards --strip-components=1 -x '*/sccache' echo "Installed $(sccache --version) to $(which sccache)" >&2 else echo "sccache v${SCCACHE_VERSION} is already installed, skipping" >&2