Adding ability to use the Locks and Latches plugin

Change-Id: I8c63de4eebd42dbe2274a560b038ffe3f7cf8598
Reviewed-on: https://review.openstack.org/15891
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:
william.soula 2012-11-10 12:18:25 -06:00 committed by Jenkins
parent a28c629cf1
commit 7d319fc9b9
2 changed files with 26 additions and 0 deletions

View File

@ -188,6 +188,31 @@ def port_allocator(parser, xml_parent, data):
XML.SubElement(dpt, 'name').text = data['name']
def locks(parser, xml_parent, data):
"""yaml: locks
Control parallel execution of jobs.
Requires the Jenkins `Locks and Latches Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Locks+and+Latches+plugin>`_
:arg: list of locks to use
Example::
wrappers:
- locks:
- FOO
- FOO2
"""
lw = XML.SubElement(xml_parent,
'hudson.plugins.locksandlatches.LockWrapper')
locktop = XML.SubElement(lw, 'locks')
locks = data
for lock in locks:
lockwrapper = XML.SubElement(locktop,
'hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig')
XML.Sublement(lockwrapper, 'name').text = lock
class Wrappers(jenkins_jobs.modules.base.Base):
sequence = 80

View File

@ -118,6 +118,7 @@ setuptools.setup(
'workspace-cleanup=jenkins_jobs.modules.wrappers:'
'workspace_cleanup',
'port-allocator=jenkins_jobs.modules.wrappers:port_allocator',
'locks=jenkins_jobs.modules.wrappers:locks',
],
'jenkins_jobs.modules': [
'assignednode=jenkins_jobs.modules.assignednode:AssignedNode',