diff options
author | Philip Hands <phil@hands.com> | 2016-07-19 19:49:44 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-19 23:15:17 +0200 |
commit | 7099cf784398347093d6d3c96975fd4b4c4dcd5e (patch) | |
tree | 64117d6b6f3baa74cee9ff5797df663d3c627c31 /bin | |
parent | d79d7c0c953eee95167b96b2caa2af286f296ff7 (diff) | |
download | jenkins.debian.net-7099cf784398347093d6d3c96975fd4b4c4dcd5e.tar.xz |
do artifact retrieval in the master wrapper
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/jenkins_master_wrapper.sh | 24 | ||||
-rwxr-xr-x | bin/lvc_retrieve_artifacts.sh | 14 |
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." |