From ab3970f37537cedd88a0c37dcf5c0b49d4695399 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 16 Apr 2022 08:39:32 -0700 Subject: [PATCH] =?utf8?q?CI:=20retry=20macOS=20libANN=20installation=20up?= =?utf8?q?=20to=202=C3=97=20on=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- ci/macos-install-build-dependencies.sh | 17 ++++++++++++++++- ci/macos-install-runtime-dependencies.sh | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) 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 -- 2.40.0