[Qa-jenkins-scm] [jenkins.debian.net] 01/03: do artifact retrieval in the master wrapper

Holger Levsen holger at layer-acht.org
Tue Jul 19 21:26:57 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 7099cf784398347093d6d3c96975fd4b4c4dcd5e
Author: Philip Hands <phil at hands.com>
Date:   Tue Jul 19 19:49:44 2016 +0200

    do artifact retrieval in the master wrapper
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/jenkins_master_wrapper.sh | 24 ++++++++++++++++++++++--
 bin/lvc_retrieve_artifacts.sh | 14 --------------
 job-cfg/lvc.yaml              | 34 ----------------------------------
 3 files changed, 22 insertions(+), 50 deletions(-)

diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh
index 7aefb74..7b5c1ff 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 146558b..0000000
--- a/bin/lvc_retrieve_artifacts.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-# Copyright 2015 Holger Levsen <holger at 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."
diff --git a/job-cfg/lvc.yaml b/job-cfg/lvc.yaml
index 1e4b284..5139681 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 at lists.alioth.debian.org, phil at 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'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list