diff --git a/sbin/prepareWorkspace.sh b/sbin/prepareWorkspace.sh index 5f44dee93..caddef32d 100644 --- a/sbin/prepareWorkspace.sh +++ b/sbin/prepareWorkspace.sh @@ -336,7 +336,18 @@ checkingAndDownloadingAlsa() { # Note: the uptime command below is to aid diagnostics for this issue: # https://github.com/adoptium/temurin-build/issues/3518#issuecomment-1792606345 uptime - gpg --keyserver keyserver.ubuntu.com --keyserver-options timeout=300 --recv-keys "${ALSA_LIB_GPGKEYID}" + # Will retry command below until it passes or we've failed 10 times. + for i in {1..10}; do + if gpg --keyserver keyserver.ubuntu.com --keyserver-options timeout=300 --recv-keys "${ALSA_LIB_GPGKEYID}"; then + echo "gpg command has passed." + break + elif [[ ${i} -lt 10 ]]; then + echo "gpg recv-keys attempt has failed. Retrying after 10 second pause..." + sleep 10s + else + echo "ERROR: gpg recv-keys final attempt has failed. Will not try again." + fi + done echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key "${ALSA_LIB_GPGKEYID}" trust; gpg --verify alsa-lib.tar.bz2.sig alsa-lib.tar.bz2 || exit 1