From 8a49d2587e00cdcc5a1a9c9efc4f7d8055e59527 Mon Sep 17 00:00:00 2001 From: codex Date: Mon, 20 Apr 2026 10:54:15 -0300 Subject: [PATCH] ci(metis): retry go downloads and always emit test outputs --- Jenkinsfile | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e25ce5a..1a9c6dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -188,7 +188,26 @@ PY apt-get update >/dev/null apt-get install -y --no-install-recommends xz-utils >/dev/null mkdir -p build - go install github.com/jstemmer/go-junit-report/v2@latest + run_with_retry() { + attempts="$1" + shift + try=1 + delay=3 + while true; do + "$@" && return 0 + rc=$? + if [ "${try}" -ge "${attempts}" ]; then + return "${rc}" + fi + echo "[quality] retry ${try}/${attempts} after rc=${rc}: $*" >&2 + sleep "${delay}" + delay=$((delay * 2)) + try=$((try + 1)) + done + } + export GOPROXY="${GOPROXY:-https://proxy.golang.org,direct}" + run_with_retry 3 go install github.com/jstemmer/go-junit-report/v2@latest + run_with_retry 4 go mod download docs_rc=1 quality_rc=1 test_rc=1 @@ -205,7 +224,10 @@ PY cd "${WORKSPACE}" if [ "${docs_rc}" -eq 0 ] && [ "${quality_rc}" -eq 0 ]; then - go test -v -count=1 -coverprofile=build/coverage.out ./... > build/test.out 2>&1 + run_with_retry 3 go test -v -count=1 -coverprofile=build/coverage.out ./... > build/test.out 2>&1 + test_rc=$? + else + run_with_retry 3 go test -v -count=1 -coverprofile=build/coverage.out ./... > build/test.out 2>&1 test_rc=$? fi set -e