Adding ability to use the Port Allocator Plugin

Change-Id: Ie64b4d3d0b1812347f6cc5921dc1cb5bb22ea27f
Reviewed-on: https://review.openstack.org/15402
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-06 21:02:30 -06:00 committed by Jenkins
parent 3cbe673615
commit 88d5d405fd
2 changed files with 23 additions and 0 deletions

View File

@ -166,6 +166,28 @@ def build_name(parser, xml_parent, data):
XML.SubElement(bsetter, 'template').text = data['name'] XML.SubElement(bsetter, 'template').text = data['name']
def port_allocator(parser, xml_parent, data):
"""yaml: port-allocator
Assign unique TCP port numbers
Requires the Jenkins `Port Allocator Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Port+Allocator+Plugin>`_
:arg str name: Variable name of the port or a specific port number
Example::
wrappers:
- port-allocator:
name: SERVER_PORT
"""
pa = XML.SubElement(xml_parent,
'org.jvnet.hudson.plugins.port__allocator.PortAllocator')
ports = XML.SubElement(pa, 'ports')
dpt = XML.SubElement(ports,
'org.jvnet.hudson.plugins.port__allocator.DefaultPortType')
XML.SubElement(dpt, 'name').text = data['name']
class Wrappers(jenkins_jobs.modules.base.Base): class Wrappers(jenkins_jobs.modules.base.Base):
sequence = 80 sequence = 80

View File

@ -97,6 +97,7 @@ setup(name='jenkins_job_builder',
'build-name=jenkins_jobs.modules.wrappers:build_name', 'build-name=jenkins_jobs.modules.wrappers:build_name',
'workspace-cleanup=jenkins_jobs.modules.wrappers:' 'workspace-cleanup=jenkins_jobs.modules.wrappers:'
'workspace_cleanup', 'workspace_cleanup',
'port-allocator=jenkins_jobs.modules.wrappers:port_allocator',
], ],
'jenkins_jobs.modules': [ 'jenkins_jobs.modules': [
'assignednode=jenkins_jobs.modules.assignednode:AssignedNode', 'assignednode=jenkins_jobs.modules.assignednode:AssignedNode',