Support the use of lists in trigger-build builder.

Since Jenkins parameterized build trigger buildstep supports comma-separated
list of jobs to build, this simply joins a list of jobs specified in JJB yaml on
a comma.

Change-Id: I0a65f3497d4a68d798ea29c580b6217bbecfe222
This commit is contained in:
Wayne 2015-01-27 14:01:07 -08:00
parent e1cc03e606
commit c5d7fa6675
3 changed files with 37 additions and 2 deletions

View File

@ -282,7 +282,7 @@ def trigger_builds(parser, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Parameterized Trigger Plugin
<Parameterized+Trigger+Plugin>`.
:arg str project: the Jenkins project to trigger
:arg list project: the Jenkins project to trigger
:arg str predefined-parameters:
key/value pairs to be passed to the job (optional)
:arg list bool-parameters:
@ -355,6 +355,12 @@ def trigger_builds(parser, xml_parent, data):
Examples:
Basic usage with yaml list of projects.
.. literalinclude::
/../../tests/builders/fixtures/trigger-builds/project-list.yaml
:language: yaml
Basic usage with passing svn revision through.
.. literalinclude:: /../../tests/builders/fixtures/trigger-builds001.yaml
@ -515,7 +521,11 @@ def trigger_builds(parser, xml_parent, data):
'ignore-offline-nodes', True)).lower()
projects = XML.SubElement(tconfig, 'projects')
projects.text = project_def['project']
if isinstance(project_def['project'], list):
projects.text = ",".join(project_def['project'])
else:
projects.text = project_def['project']
condition = XML.SubElement(tconfig, 'condition')
condition.text = 'ALWAYS'
trigger_with_no_params = XML.SubElement(tconfig,

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.parameterizedtrigger.TriggerBuilder>
<configs>
<hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
<configs>
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
</configs>
<projects>foo,bar,baz</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
<buildAllNodesWithLabel>false</buildAllNodesWithLabel>
</hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.TriggerBuilder>
</builders>
</project>

View File

@ -0,0 +1,7 @@
builders:
- trigger-builds:
- project:
- "foo"
- "bar"
- "baz"
current-parameters: true