[Qa-jenkins-scm] [jenkins.debian.net] 01/01: retry debootstrap after 5min on failure

Holger Levsen holger at moszumanska.debian.org
Mon Sep 7 15:30:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit a0eea0e2e743f0798668da61c5acc788e9478168
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Sep 7 17:30:09 2015 +0200

    retry debootstrap after 5min on failure
---
 bin/schroot-create.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh
index 3c56256..1b23f7d 100755
--- a/bin/schroot-create.sh
+++ b/bin/schroot-create.sh
@@ -39,6 +39,8 @@ shift
 SUITE="$1"
 shift
 
+TMPLOG=$(mktemp)
+
 declare -a EXTRA_SOURCES
 if [ "$SUITE" = "experimental" ] ; then
 	# experimental cannot be bootstrapped
@@ -100,7 +102,17 @@ bootstrap() {
 	echo force-unsafe-io > "$CHROOT_TARGET/etc/dpkg/dpkg.cfg.d/02dpkg-unsafe-io"
 
 	echo "Bootstraping $SUITE into $CHROOT_TARGET now."
-	sudo debootstrap $SUITE $CHROOT_TARGET $MIRROR
+	set +e
+	sudo debootstrap $SUITE $CHROOT_TARGET $MIRROR | tee $TMPLOG
+	RESULT=$(egrep "E: Couldn't download packages" $TMPLOG)
+	set -e
+	if [ -z "$RESULT" ] ; then
+		echo "$(date -u) - initial debootstrap failed, sleeping 5min before retrying..."
+		rm $CHROOT_TARGET -rf
+		sleep 5m
+		sudo debootstrap $SUITE $CHROOT_TARGET $MIRROR
+	fi
+	rm -f $TMPLOG
 
 	echo -e '#!/bin/sh\nexit 101'              | sudo tee   $CHROOT_TARGET/usr/sbin/policy-rc.d >/dev/null
 	sudo chmod +x $CHROOT_TARGET/usr/sbin/policy-rc.d
@@ -160,6 +172,7 @@ cleanup() {
 	if [ -d $CHROOT_TARGET ]; then
 		sudo rm -rf --one-file-system $CHROOT_TARGET || ( echo "Warning: $CHROOT_TARGET could not be fully removed on forced cleanup." ; fuser -mv $CHROOT_TARGET ; ls $CHROOT_TARGET -la )
 	fi
+	rm -f $TMPLOG
 }
 trap cleanup INT TERM EXIT
 bootstrap $@

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list