From 89ee8640f67c5e926a0665799ba65ba82398b7ea Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 11 Jun 2016 12:50:25 +0200 Subject: reproducible debian: refactor, add new function check_node_is_up() --- bin/reproducible_build.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'bin/reproducible_build.sh') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 488cc409..20d5f7fb 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...) -- cgit v1.2.3-70-g09d2