From 2da1d0fe7d6a1aa4b289d4690a7cf41acdb62230 Mon Sep 17 00:00:00 2001 From: Mikhail Shchatko Date: Thu, 12 Sep 2024 10:14:38 +0300 Subject: [PATCH] SERVER-94662 Retry pipx install db-contrib-tool (#26948) GitOrigin-RevId: 0d3bbbaa49475e9a44af364365659f8b78535ee7 --- evergreen/prelude_db_contrib_tool.sh | 36 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/evergreen/prelude_db_contrib_tool.sh b/evergreen/prelude_db_contrib_tool.sh index 5c761302c8f..e111ea2e6bb 100644 --- a/evergreen/prelude_db_contrib_tool.sh +++ b/evergreen/prelude_db_contrib_tool.sh @@ -5,9 +5,35 @@ function setup_db_contrib_tool { export PIPX_BIN_DIR="${workdir}/pipx/bin" export PATH="$PATH:$PIPX_BIN_DIR" - python -m pip --disable-pip-version-check install "pip==21.0.1" "wheel==0.37.0" || exit 1 - # We force reinstall here because when we download the previous venv the shebang - # in pipx still points to the old machines python location. - python -m pip --disable-pip-version-check install --force-reinstall --no-deps "pipx==1.6.0" || exit 1 - pipx install "db-contrib-tool==0.8.5" --pip-args="--no-cache-dir" || exit 1 + for i in {1..5}; do + python -m pip --disable-pip-version-check install "pip==21.0.1" "wheel==0.37.0" && RET=0 && break || RET=$? && sleep 1 + echo "Failed to install pip and wheel, retrying..." + done + + if [ $RET -ne 0 ]; then + echo "Failed to install pip and wheel" + exit $RET + fi + + for i in {1..5}; do + # We force reinstall here because when we download the previous venv the shebang + # in pipx still points to the old machines python location. + python -m pip --disable-pip-version-check install --force-reinstall --no-deps "pipx==1.6.0" && RET=0 && break || RET=$? && sleep 1 + echo "Failed to install pipx, retrying..." + done + + if [ $RET -ne 0 ]; then + echo "Failed to install pipx" + exit $RET + fi + + for i in {1..5}; do + pipx install --force "db-contrib-tool==0.8.5" --pip-args="--no-cache-dir" && RET=0 && break || RET=$? && sleep 1 + echo "Failed to install db-contrib-tool, retrying..." + done + + if [ $RET -ne 0 ]; then + echo "Failed to install db-contrib-tool" + exit $RET + fi }