From: Matthew Fernandez Date: Sat, 16 Apr 2022 15:39:32 +0000 (-0700) Subject: CI: retry macOS libANN installation up to 2× on failure X-Git-Tag: 4.0.0~90^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab3970f37537cedd88a0c37dcf5c0b49d4695399;p=graphviz CI: retry macOS libANN installation up to 2× on failure libANN availability seems erratic, with Macports sometimes reporting: Error: Port libANN not found only for a retry of the job to succeed. This change introduces an auto-retry loop on libANN’s installation, hoping this will ameliorate the issue. --- diff --git a/ci/macos-install-build-dependencies.sh b/ci/macos-install-build-dependencies.sh index 91d5620d3..b6e4bbb8b 100644 --- a/ci/macos-install-build-dependencies.sh +++ b/ci/macos-install-build-dependencies.sh @@ -54,5 +54,20 @@ curl --retry 3 --location --no-progress-meter -O \ sudo installer -package MacPorts-2.7.2-12-Monterey.pkg -target / export PATH=/opt/local/bin:${PATH} +# `port install` with retry because packages sometimes transiently 404 +function port_install { + for i in 1 2 3; do + set +e + sudo port install "$@" + RET=$? + set -e + if [ ${RET} -eq 0 ]; then + return 0 + fi + sleep $((10 * 2 ** (${i} - 1))) # exponential back off + done + return -1 +} + # lib/mingle dependency -sudo port install libANN +port_install libANN diff --git a/ci/macos-install-runtime-dependencies.sh b/ci/macos-install-runtime-dependencies.sh index 0dc687f77..c6632f169 100644 --- a/ci/macos-install-runtime-dependencies.sh +++ b/ci/macos-install-runtime-dependencies.sh @@ -36,7 +36,22 @@ curl --retry 3 --location --no-progress-meter -O \ sudo installer -package MacPorts-2.7.2-12-Monterey.pkg -target / export PATH=/opt/local/bin:${PATH} +# `port install` with retry because packages sometimes transiently 404 +function port_install { + for i in 1 2 3; do + set +e + sudo port install "$@" + RET=$? + set -e + if [ ${RET} -eq 0 ]; then + return 0 + fi + sleep $((10 * 2 ** (${i} - 1))) # exponential back off + done + return -1 +} + # lib/mingle dependency -sudo port install libANN +port_install libANN python3 -m pip install --requirement requirements.txt