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 only runs in the prebuilder step
which occurs aftern a build environment step (wrapper).  We want the
maven-properties.sh script to run after gerrit-git-prep because the
it queries for git info. A workaround is to call gerrit-git-prep
inside of the maven-properties script so it will run in the correct order.

Change-Id: Ie0a72d8509f5f1453e027486285c2817dbc67eb5
Reviewed-on: https://review.openstack.org/36879
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-07-12 11:27:57 -07:00 committed by Jenkins
parent 36e1f8e3b8
commit 9e258ea5aa
2 changed files with 6 additions and 6 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

View File

@ -1,11 +1,11 @@
# 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:
- timeout:
timeout: 30
@ -32,9 +32,6 @@
project-type: maven
node: precise
prebuilders:
- gerrit-git-prep
wrappers:
- timeout:
timeout: 30