ci(ananke): retry staticcheck installation

This commit is contained in:
codex 2026-04-22 05:16:45 -03:00
parent a80acfc343
commit d8cff09aef

View File

@ -6,9 +6,28 @@ cd "${REPO_DIR}"
export PATH="$(go env GOPATH)/bin:${PATH}" export PATH="$(go env GOPATH)/bin:${PATH}"
STATICCHECK_VERSION="${ANANKE_STATICCHECK_VERSION:-2025.1.1}" STATICCHECK_VERSION="${ANANKE_STATICCHECK_VERSION:-2025.1.1}"
run_with_retry() {
local attempts="$1"
shift
local try=1
local delay=3
local rc=0
while true; do
"$@" && return 0
rc=$?
if [[ "${try}" -ge "${attempts}" ]]; then
return "${rc}"
fi
echo "[lint] retry ${try}/${attempts} after rc=${rc}: $*" >&2
sleep "${delay}"
delay=$((delay * 2))
try=$((try + 1))
done
}
if ! command -v staticcheck >/dev/null 2>&1 || ! staticcheck -version 2>/dev/null | grep -q "${STATICCHECK_VERSION}"; then if ! command -v staticcheck >/dev/null 2>&1 || ! staticcheck -version 2>/dev/null | grep -q "${STATICCHECK_VERSION}"; then
echo "[lint] installing staticcheck ${STATICCHECK_VERSION}" echo "[lint] installing staticcheck ${STATICCHECK_VERSION}"
go install "honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}" run_with_retry 4 go install "honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}"
fi fi
echo "[lint] go vet" echo "[lint] go vet"