From 7099cf784398347093d6d3c96975fd4b4c4dcd5e Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Tue, 19 Jul 2016 19:49:44 +0200 Subject: do artifact retrieval in the master wrapper Signed-off-by: Holger Levsen --- bin/jenkins_master_wrapper.sh | 24 ++++++++++++++++++++++-- bin/lvc_retrieve_artifacts.sh | 14 -------------- job-cfg/lvc.yaml | 34 ---------------------------------- 3 files changed, 22 insertions(+), 50 deletions(-) delete mode 100755 bin/lvc_retrieve_artifacts.sh 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 -# 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." diff --git a/job-cfg/lvc.yaml b/job-cfg/lvc.yaml index 1e4b2846..5139681d 100644 --- a/job-cfg/lvc.yaml +++ b/job-cfg/lvc.yaml @@ -41,9 +41,6 @@ - title: '{my_title}' includes: '{my_pngs}' image-width: 300 - - trigger-parameterized-builds: - - project: lvc_retrieve_artifacts - predefined-parameters: "TRIG_NODE=$NODE_NAME\nTRIG_RESULTS=$WORKSPACE/results" wrappers: - live-screenshot builders: @@ -56,35 +53,6 @@ defaults: lvc name: '{name}_{distro}' -- job-template: - name: '{name}_retrieve_artifacts' - project-type: freestyle - description: *desc - properties: - - sidebar: *sb1 - - sidebar: *sb2 - - sidebar: *sb3 - parameters: - - string: - name: TRIG_NODE - description: The host that the job triggering this one was running on - - string: - name: TRIG_RESULTS - description: The results directory for the job that triggered this one - logrotate: - daysToKeep: 90 - numToKeep: 20 - artifactDaysToKeep: -1 - artifactNumToKeep: -1 - publishers: - - email: - recipients: 'qa-jenkins-scm@lists.alioth.debian.org, phil@hands.com' - wrappers: - - live-screenshot - builders: - - shell: '/srv/jenkins/bin/lvc_retrieve_artifacts.sh' - node: 'master' - - project: name: lvc my_title: 'Cucumber: {dist_name}' @@ -113,5 +81,3 @@ my_iso: 'http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso' my_time: 'H H * * H' my_opts: '--tags @broken' - - '{name}_retrieve_artifacts': - my_title: 'Retrieve results from LVC job' -- cgit v1.2.3-70-g09d2