]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Retry package installation 3 times.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 13 Jan 2023 12:02:34 +0000 (23:02 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 13 Jan 2023 12:05:08 +0000 (23:05 +1100)
When setting up the CI environment, retry package installation 3 times
before going up.  Should help prevent spurious failures during
infrastructure issues.

.github/setup_ci.sh

index 044c4d1292b1c4460e77ae23531cce427950e5b9..e4480e614f3145d051205207fda8fcbaa00c5dd5 100755 (executable)
@@ -139,16 +139,29 @@ if [ "yes" = "$INSTALL_FIDO_PPA" ]; then
     sudo apt-add-repository -y ppa:yubico/stable
 fi
 
-if [ "x" != "x$PACKAGES" ]; then
+tries=3
+while [ ! -z "$PACKAGES" ] && [ "$tries" -gt "0" ]; do
     case "$PACKAGER" in
     apt)
        sudo apt update -qq
-       sudo apt install -qy $PACKAGES
+       if sudo apt install -qy $PACKAGES; then
+               PACKAGES=""
+       fi
        ;;
     setup)
-       /cygdrive/c/setup.exe -q -P `echo "$PACKAGES" | tr ' ' ,`
+       if /cygdrive/c/setup.exe -q -P `echo "$PACKAGES" | tr ' ' ,`; then
+               PACKAGES=""
+       fi
        ;;
     esac
+    if [ ! -z "$PACKAGES" ]; then
+       sleep 90
+    fi
+    tries=$(($tries - 1))
+done
+if [ ! -z "$PACKAGES" ]; then
+       echo "Package installation failed."
+       exit 1
 fi
 
 if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then