Skip to content

Commit

Permalink
WIP: Rerun gpg recv-keys command multiple times (#3544)
Browse files Browse the repository at this point in the history
Rerun the recv-keys command 10 times if it fails

This allows us to hopefully provide some tolerance against the
timeout errors, while at the same time using the same keyserver;
fixing the problem while not modifying our risk profile.

Signed-off-by: Adam Farley <adfarley@redhat.com>
  • Loading branch information
adamfarley authored Dec 1, 2023
1 parent d23434c commit da2408e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit da2408e

Please sign in to comment.