ci(metis): retry transient go module fetches
This commit is contained in:
parent
f31451d4e6
commit
18c570448b
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@ -190,6 +190,26 @@ PY
|
|||||||
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
|
go install github.com/jstemmer/go-junit-report/v2@latest
|
||||||
|
export GOPROXY="${GOPROXY:-https://proxy.golang.org,direct}"
|
||||||
|
retry_command() {
|
||||||
|
attempts=4
|
||||||
|
delay=8
|
||||||
|
attempt=1
|
||||||
|
while [ "${attempt}" -le "${attempts}" ]; do
|
||||||
|
"$@"
|
||||||
|
rc=$?
|
||||||
|
if [ "${rc}" -eq 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [ "${attempt}" -eq "${attempts}" ]; then
|
||||||
|
return "${rc}"
|
||||||
|
fi
|
||||||
|
echo "command failed with rc=${rc}; retrying in ${delay}s (${attempt}/${attempts})"
|
||||||
|
sleep "${delay}"
|
||||||
|
delay=$((delay * 2))
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
cd "${WORKSPACE}"
|
cd "${WORKSPACE}"
|
||||||
docs_rc=1
|
docs_rc=1
|
||||||
quality_rc=1
|
quality_rc=1
|
||||||
@ -197,17 +217,17 @@ PY
|
|||||||
|
|
||||||
set +e
|
set +e
|
||||||
cd "${WORKSPACE}/testing"
|
cd "${WORKSPACE}/testing"
|
||||||
METIS_USE_EXISTING_COVERAGE=1 go test -v -run TestExportedDocs ./...
|
retry_command env METIS_USE_EXISTING_COVERAGE=1 go test -v -run TestExportedDocs ./...
|
||||||
docs_rc=$?
|
docs_rc=$?
|
||||||
printf '%s\n' "${docs_rc}" > "${WORKSPACE}/build/docs-naming.rc"
|
printf '%s\n' "${docs_rc}" > "${WORKSPACE}/build/docs-naming.rc"
|
||||||
if [ "${docs_rc}" -eq 0 ]; then
|
if [ "${docs_rc}" -eq 0 ]; then
|
||||||
METIS_USE_EXISTING_COVERAGE=1 go test -v ./...
|
retry_command env METIS_USE_EXISTING_COVERAGE=1 go test -v ./...
|
||||||
quality_rc=$?
|
quality_rc=$?
|
||||||
fi
|
fi
|
||||||
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
|
retry_command 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