honor ZUUL_UUID where UUID is used

The addition of ZUUL_COMMIT (commit 81515ad, change I88c38a28)
deprecated the UUID parameter in favor of ZUUL_UUID but did not honor
the new parameter.

This patch add ZUUL_UUID lookup in jenkins_endpoint() and
findBuildInQueue() with a fallback on UUID. Probably only needed on
jenkins_endpoint() when a Jenkins job lack the UUID parameter, but I
think we might as well add it in findBuildInQueue() just to be safe.

Also update the documentation to uses ZUUL_ prefixed variables where
relevant and added a note about GERRIT_PROJECT and UUID being
deprecated.

Change-Id: Ie0426f388cbd3a373af2110b7460aca6ff4f1751
Reviewed-on: https://review.openstack.org/14327
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
changes/33/14433/1
Antoine Musso 10 years ago committed by Jenkins
parent ca0466e76d
commit 76904f2f98
  1. 16
      doc/source/launchers.rst
  2. 8
      zuul/launcher/jenkins.py

@ -70,11 +70,17 @@ with the type **String Parameter**:
**ZUUL_COMMIT**
The commit SHA1 at the head of ZUUL_REF
Those are the only required parameters. The UUID is needed for Zuul
to keep track of the build, and the REF and COMMIT parameters are for
use in preparing the git repo for the build. The following parameters
will be sent for all builds, but are not required so you do not need
to configure Jenkins to accept them if you do not plan on using them:
Those are the only required parameters. The ZUUL_UUID is needed for Zuul to
keep track of the build, and the ZUUL_REF and ZUUL_COMMIT parameters are for
use in preparing the git repo for the build.
.. note::
The GERRIT_PROJECT and UUID parameters are deprecated respectively in
favor of ZUUL_PROJECT and ZUUL_UUID.
The following parameters will be sent for all builds, but are not required so
you do not need to configure Jenkins to accept them if you do not plan on using
them:
**ZUUL_PROJECT**
The project that triggered this build

@ -80,7 +80,8 @@ class JenkinsCallback(threading.Thread):
number = build.get('number')
params = build.get('parameters')
if params:
uuid = params.get('UUID')
# UUID is deprecated in favor of ZUUL_UUID
uuid = params.get('ZUUL_UUID') or params.get('UUID')
if (status and url and uuid and phase and
phase == 'COMPLETED'):
self.jenkins.onBuildCompleted(uuid,
@ -331,8 +332,9 @@ class Jenkins(object):
continue
parameters = action['parameters']
for param in parameters:
if (param['name'] == 'UUID' and
build.uuid == param['value']):
# UUID is deprecated in favor of ZUUL_UUID
if ((param['name'] in ['ZUUL_UUID', 'UUID'])
and build.uuid == param['value']):
return item
return False

Loading…
Cancel
Save