The jenkins maven builder cannot reference environment variables if it is set
by the EnvInject plugin at the prebuilder step.  However the maven builder CAN
reference variables when loaded from the build environment setup (wrapper) step.
The only problem is that gerrit-git-prep runs in prebuilder step which occurs after
a build environment step.  We want the script to run after gerrit-git-prep so
we are calling the gerrit-git-prep in script so it will run in correct order.

Change-Id: Iedd7561b4ef8e19b3713b63bb76b9b754ce116e9
Reviewed-on: https://review.openstack.org/34023
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
zaro0508 2013-06-21 11:12:55 -07:00 committed by Jenkins
parent 46c3eadc7c
commit 3585081d4d
2 changed files with 11 additions and 7 deletions

View File

@ -5,6 +5,9 @@
# 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
@ -26,5 +29,5 @@ else
fi
echo "SCM_SHA=$SCM_SHA" >maven.properties
echo "COMMITS_SINCE_TAG=$COMMITS_SINCE_TAG" >>maven.properties
echo "PROJECT_VER=$PROJECT_VER" >>maven.properties
echo "COMMITS_SINCE_TAG=$COMMITS_SINCE_TAG" >>maven.properties

View File

@ -1,13 +1,15 @@
# 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
- shell: "/usr/local/jenkins/slave_scripts/maven-properties.sh"
wrappers:
- inject:
properties-file: maven.properties
script-file: /usr/local/jenkins/slave_scripts/maven-properties.sh
maven:
maven-name: Maven3
@ -25,11 +27,10 @@
project-type: maven
node: precise
prebuilders:
- gerrit-git-prep
- shell: "/usr/local/jenkins/slave_scripts/maven-properties.sh"
wrappers:
- inject:
properties-file: maven.properties
script-file: /usr/local/jenkins/slave_scripts/maven-properties.sh
maven:
maven-name: Maven3