ci(ananke): retry staticcheck installation
This commit is contained in:
parent
a80acfc343
commit
d8cff09aef
@ -6,9 +6,28 @@ cd "${REPO_DIR}"
|
||||
export PATH="$(go env GOPATH)/bin:${PATH}"
|
||||
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
|
||||
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
|
||||
|
||||
echo "[lint] go vet"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user