summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2016-06-11 12:50:25 +0200
committerHolger Levsen <holger@layer-acht.org>2016-06-11 13:00:15 +0200
commit89ee8640f67c5e926a0665799ba65ba82398b7ea (patch)
tree0c4f595400b36aaafebf5e856d4d2d9000e36a61
parent1bfb1eb4a5207dbd7f308a514915fef0bfe366e7 (diff)
downloadjenkins.debian.net-89ee8640f67c5e926a0665799ba65ba82398b7ea.tar.xz
reproducible debian: refactor, add new function check_node_is_up()
-rwxr-xr-xbin/reproducible_build.sh23
1 files changed, 16 insertions, 7 deletions
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...)