summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/jenkins_master_wrapper.sh24
-rwxr-xr-xbin/lvc_retrieve_artifacts.sh14
2 files changed, 22 insertions, 16 deletions
diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh
index 7aefb747..7b5c1ff3 100755
--- a/bin/jenkins_master_wrapper.sh
+++ b/bin/jenkins_master_wrapper.sh
@@ -26,6 +26,7 @@ case $JOB_NAME in
rebootstrap_*) PARAMS="$JOB_NAME $@"
;;
lvc_*) PARAMS="$JOB_NAME $EXECUTOR_NUMBER TRIGGERING_BRANCH=${TRIGGERING_BRANCH:-} $@"
+ RETRIEVE_ARTIFACTS=yes
export
;;
*) PARAMS="$JOB_NAME"
@@ -50,6 +51,25 @@ if [ $RESULT -ne 0 ] ; then
exec /srv/jenkins/bin/abort.sh
fi
set -e
-# finally
-exec ssh -o "BatchMode = yes" -p $PORT $NODE_NAME "$PARAMS"
+# run things on the target node
+RETVAL=0
+ssh -o "BatchMode = yes" -p $PORT $NODE_NAME "$PARAMS" || {
+ # mention failures, but continue since we might want the artifacts anyway
+ RETVAL=$?
+ printf "\nnSSH EXIT CODE: %s\n" $RETVAL
+}
+# grab artifacts and tidy up at the other end
+if [ "$RETRIEVE_ARTIFACTS" ] ; then
+ RESULTS="$WORKSPACE/results"
+ NODE_RESULTS="/var/libjenkins/jobs/$JOB_NAME/workspace/results"
+
+ echo "$(date -u) - retrieving artifacts."
+ set -x
+ mkdir -p $RESULTS
+ rsync -r -v -e "ssh -o 'Batchmode = yes'" "$NODE_NAME:$NODE_RESULTS/" "$RESULTS/"
+ chmod 775 /$WORKSPACE/results/
+ ssh -o "BatchMode = yes" -p $PORT $NODE_NAME "rm -rf '$NODE_RESULTS'"
+fi
+
+exit $RETVAL
diff --git a/bin/lvc_retrieve_artifacts.sh b/bin/lvc_retrieve_artifacts.sh
deleted file mode 100755
index 146558b6..00000000
--- a/bin/lvc_retrieve_artifacts.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-# Copyright 2015 Holger Levsen <holger@layer-acht.org>
-# released under the GPLv=2
-
-DEBUG=true
-. /srv/jenkins/bin/common-functions.sh
-common_init "$@"
-
-# main
-echo "$(date -u) - Starting to rsync results."
-rsync -r -v -e "ssh -o 'Batchmode = yes'" $TRIG_NODE:$TRIG_RESULTS/ /$TRIG_RESULTS/
-chmod 775 $TRIG_RESULTS
-echo "$(date -u) - the end."