ci(metis): retry go downloads and always emit test outputs
This commit is contained in:
parent
4395f8012c
commit
8a49d2587e
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@ -188,7 +188,26 @@ PY
|
|||||||
apt-get update >/dev/null
|
apt-get update >/dev/null
|
||||||
apt-get install -y --no-install-recommends xz-utils >/dev/null
|
apt-get install -y --no-install-recommends xz-utils >/dev/null
|
||||||
mkdir -p build
|
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
|
docs_rc=1
|
||||||
quality_rc=1
|
quality_rc=1
|
||||||
test_rc=1
|
test_rc=1
|
||||||
@ -205,7 +224,10 @@ PY
|
|||||||
cd "${WORKSPACE}"
|
cd "${WORKSPACE}"
|
||||||
|
|
||||||
if [ "${docs_rc}" -eq 0 ] && [ "${quality_rc}" -eq 0 ]; then
|
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=$?
|
test_rc=$?
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user