added support for NodeLabel parameter in trigger-builds

Updated trigger-builds to take NodeLabel parameter name and value
Updated unit tests

Change-Id: I7ea2db6d434bf8224e1e51c27f4b657141bf86f0
This commit is contained in:
Jaime Flynn 2015-04-08 15:58:49 -05:00
parent d976466c10
commit e1913ab0cc
3 changed files with 21 additions and 0 deletions

View File

@ -298,6 +298,12 @@ def trigger_builds(parser, xml_parent, data):
:arg bool current-parameters: Whether to include the
parameters passed to the current build to the
triggered job.
:arg str node-label-name: Define a name for the NodeLabel parameter to be
set. Used in conjunction with node-label. Requires NodeLabel Parameter
Plugin (optional)
:arg str node-label: Label of the nodes where build should be triggered.
Used in conjunction with node-label-name. Requires NodeLabel Parameter
Plugin (optional)
:arg bool svn-revision: Whether to pass the svn revision
to the triggered job
:arg bool git-revision: Whether to pass the git revision
@ -432,6 +438,15 @@ def trigger_builds(parser, xml_parent, data):
XML.SubElement(param, 'value').text = str(
bool_param.get('value', False)).lower()
if 'node-label-name' in project_def and 'node-label' in project_def:
node = XML.SubElement(tconfigs, 'org.jvnet.jenkins.plugins.'
'nodelabelparameter.parameterizedtrigger.'
'NodeLabelBuildParameter')
XML.SubElement(node, 'name').text = \
project_def.get('node-label-name')
XML.SubElement(node, 'nodeLabel').text = \
project_def.get('node-label')
if(len(list(tconfigs)) == 0):
tconfigs.set('class', 'java.util.Collections$EmptyList')

View File

@ -12,6 +12,10 @@
<hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
<properties>FOO=&quot;bar&quot;</properties>
</hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
<org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.NodeLabelBuildParameter>
<name>NODE</name>
<nodeLabel>testnodes</nodeLabel>
</org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.NodeLabelBuildParameter>
</configs>
<projects>build_started</projects>
<condition>ALWAYS</condition>

View File

@ -4,5 +4,7 @@ builders:
predefined-parameters:
FOO="bar"
current-parameters: true
node-label-name: NODE
node-label: testnodes
git-revision: true
block: true