From d1478aabf70195e2ae8a71dbed0cb54602fc1f44 Mon Sep 17 00:00:00 2001 From: zaro0508 Date: Fri, 28 Jun 2013 14:39:41 -0400 Subject: [PATCH] run script and load properties in correct order By default the EnvInject plugin loads the properties file before running the bash script when defined in wrapper section. However we want the opposite execution order, run script then load properties file. To work around this ordering problem we need to define two instances of EnvInject, 1st instance to run the script and 2nd instance to load the properties file. This cannot be done in jenkins UI, but apparently works when defined in JJB. This will also let us run gerrit-git-prep in the more conventional pre-builder step. Change-Id: I7a16143a2f9b79d2dbe2684a7d016f6640f5a707 Reviewed-on: https://review.openstack.org/34936 Reviewed-by: James E. Blair Reviewed-by: matthew wagoner Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- .../files/slave_scripts/maven-properties.sh | 3 --- .../config/jenkins-plugin-jobs.yaml | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/jenkins/files/slave_scripts/maven-properties.sh b/modules/jenkins/files/slave_scripts/maven-properties.sh index e585462318..7386acb20c 100755 --- a/modules/jenkins/files/slave_scripts/maven-properties.sh +++ b/modules/jenkins/files/slave_scripts/maven-properties.sh @@ -5,9 +5,6 @@ # pass to maven build commands so that we can generate # versioned builds within the gerrit workflow. -# work around for jenkins bug: https://issues.jenkins-ci.org/browse/JENKINS-14193 -/usr/local/jenkins/slave_scripts/gerrit-git-prep.sh https://review.openstack.org http://zuul.openstack.org - # get version info from scm SCM_TAG=`git describe --abbrev=0 --tags` || true SCM_SHA=`git rev-parse --short HEAD` || true diff --git a/modules/openstack_project/files/jenkins_job_builder/config/jenkins-plugin-jobs.yaml b/modules/openstack_project/files/jenkins_job_builder/config/jenkins-plugin-jobs.yaml index 794d79d5e7..f31047dedc 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/jenkins-plugin-jobs.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/jenkins-plugin-jobs.yaml @@ -1,15 +1,16 @@ -# need to run gerrit-git-prep in maven-properties.sh script to work -# around jenkins bug: https://issues.jenkins-ci.org/browse/JENKINS-14193 - - job-template: name: 'gate-{name}-build' project-type: maven node: precise + prebuilders: + - gerrit-git-prep + wrappers: - inject: - properties-file: maven.properties script-file: /usr/local/jenkins/slave_scripts/maven-properties.sh + - inject: + properties-file: ${WORKSPACE}/maven.properties maven: maven-name: Maven3 @@ -27,10 +28,14 @@ project-type: maven node: precise + prebuilders: + - gerrit-git-prep + wrappers: - inject: - properties-file: maven.properties script-file: /usr/local/jenkins/slave_scripts/maven-properties.sh + - inject: + properties-file: ${WORKSPACE}/maven.properties maven: maven-name: Maven3