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 <corvus@inaugust.com>
Reviewed-by: matthew wagoner <zxkuqyb@gmail.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
zaro0508 2013-06-28 14:39:41 -04:00 committed by Jenkins
parent 94b59469d8
commit d1478aabf7
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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