[Qa-jenkins-scm] [jenkins.debian.net] 01/01: chroot-installation: retry once, if debootstrap fails to download packages

Holger Levsen holger at moszumanska.debian.org
Thu Sep 10 15:09:57 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 a4c42afb30d417603aa1dba99a5824e04d20ec51
Author: Holger Levsen <holger at layer-acht.org>
Date:   Thu Sep 10 17:09:18 2015 +0200

    chroot-installation: retry once, if debootstrap fails to download packages
---
 bin/chroot-run.sh | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/bin/chroot-run.sh b/bin/chroot-run.sh
index 7ce2ad2..dfdf75c 100755
--- a/bin/chroot-run.sh
+++ b/bin/chroot-run.sh
@@ -53,12 +53,23 @@ bootstrap() {
 	mkdir -p "$CHROOT_TARGET/etc/dpkg/dpkg.cfg.d"
 	echo force-unsafe-io > "$CHROOT_TARGET/etc/dpkg/dpkg.cfg.d/02dpkg-unsafe-io"
 
-	echo "Bootstraping $DISTRO into $CHROOT_TARGET now."
-	if ! sudo debootstrap $BOOTSTRAP_OPTIONS $DISTRO $CHROOT_TARGET $MIRROR; then
-		SLEEPTIME=1800
-		echo "debootstrap failed, slowing down, sleeping $SLEEPTIME now..."
-		sleep $SLEEPTIME
-		exit 1
+	local TMPLOG=$(mktemp -p $CHROOT_BASE/ chroot-run-$DISTRO.XXXXXXXXX)
+	echo "$(date -u ) - bootstraping $DISTRO into $CHROOT_TARGET now."
+	set +e
+	sudo debootstrap BOOTSTRAP_OPTIONS $DISTRO $CHROOT_TARGET $MIRROR | tee $TMPLOG
+	local RESULT=$(egrep "E: Couldn't download packages" $TMPLOG)
+	rm $TMPLOG
+	set -e
+	if [ ! -z "$RESULT" ] ; then
+	        echo "$(date -u) - initial debootstrap failed, sleeping 5min before retrying..."
+	        sudo rm -rf --one-file-system $CHROOT_TARGET
+	        sleep 5m
+	        if ! sudo debootstrap BOOTSTRAP_OPTIONS $DISTRO $CHROOT_TARGET $MIRROR ; then
+			SLEEPTIME="30m"
+			echo "$(date -u ) - debootstrap failed, slowing down, sleeping $SLEEPTIME now..."
+			sleep $SLEEPTIME
+			exit 1
+		fi
 	fi
 
 	cat > $CHROOT_TARGET/tmp/chroot-prepare <<-EOF

-- 
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