[Qa-jenkins-scm] [jenkins.debian.net] 02/03: reproducible debian: refactor, add new function check_node_is_up()

Holger Levsen holger at layer-acht.org
Sat Jun 11 11:02:43 UTC 2016


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 89ee8640f67c5e926a0665799ba65ba82398b7ea
Author: Holger Levsen <holger at layer-acht.org>
Date:   Sat Jun 11 12:50:25 2016 +0200

    reproducible debian: refactor, add new function check_node_is_up()
---
 bin/reproducible_build.sh | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 488cc40..20d5f7f 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -641,23 +641,32 @@ EOF
 	rm $TMPCFG
 }
 
-remote_build() {
-	local BUILDNR=$1
-	local NODE=$2
-	get_node_ssh_port $NODE
+check_node_is_up() {
+	local NODE=$1
+	local PORT=$2
+	local SLEEPTIME=$3
 	set +e
 	ssh -o "BatchMode = yes" -p $PORT $NODE /bin/true
 	RESULT=$?
 	# abort job if host is down
 	if [ $RESULT -ne 0 ] ; then
-		# sleep 15min if this happens on the first node
-		# but 1h if this happens on the 2nd node
-		SLEEPTIME=$(echo "$BUILDNR*$BUILDNR*15"|bc)
 		echo "$(date -u) - $NODE seems to be down, sleeping ${SLEEPTIME}min before aborting this job."
 		unregister_build
 		sleep ${SLEEPTIME}m
 		exec /srv/jenkins/bin/abort.sh
 	fi
+	set -e
+}
+
+remote_build() {
+	local BUILDNR=$1
+	local NODE=$2
+	get_node_ssh_port $NODE
+	# sleep 15min if first node is down
+	# but 1h if the 2nd node is down
+	local SLEEPTIME=$(echo "$BUILDNR*$BUILDNR*15"|bc)
+	check_node_is_up $NODE $PORT $SLEEPTIME
+	set +e
 	ssh -o "BatchMode = yes" -p $PORT $NODE /srv/jenkins/bin/reproducible_build.sh $BUILDNR ${SRCPACKAGE} ${SUITE} ${TMPDIR}
 	RESULT=$?
 	# 404-256=148... (ssh 'really' only 'supports' exit codes below 255...)

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