From f2eb7acbbca71cf28dcfa8f689c3f8059e42670e Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 2 Sep 2015 14:27:23 +0200 Subject: reproducibly: retry 'apt-get update' three times for each schroot before giving up, also fail gracefully --- bin/reproducible_maintenance.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh index 492e6fec..890185f0 100755 --- a/bin/reproducible_maintenance.sh +++ b/bin/reproducible_maintenance.sh @@ -267,5 +267,20 @@ for s in $SUITES ; do continue fi echo "$(date -u) - updating the $s/$ARCH schroot now." - schroot --directory /root -u root -c source:jenkins-reproducible-$s -- apt-get update + set +e + for i in 1 2 3 ; do + schroot --directory /root -u root -c source:jenkins-reproducible-$s -- apt-get update + RESULT=$? + if [ $RESULT -eq 1 ] ; then + # sleep 31-100 secs + echo "Sleeping some time... (to workaround network problems like 'Hash Sum mismatch'...)" + /bin/sleep $(echo "scale=1 ; ($(shuf -i 1-700 -n 1)/10)+30" | bc ) + echo "$(date -u) - Retrying to update the $s/$ARCH schroot." + elif [ $RESULT -eq 0 ] ; then + continue + fi + done + if [ $RESULT -eq 1 ] ; then + echo "Warning: failed to update the $s/$ARCH schroot." + fi done -- cgit v1.2.3-54-g00ecf