Merge "Add support for parameters in pipeline publisher."
This commit is contained in:
commit
daac225639
@ -1160,12 +1160,16 @@ def pipeline(parser, xml_parent, data):
|
||||
Requires the Jenkins `Build Pipeline Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin>`_
|
||||
|
||||
:Parameter: the name of the downstream project
|
||||
:arg str project: the name of the downstream project
|
||||
:arg str predefined-parameters: parameters to pass to the other
|
||||
job (optional)
|
||||
:arg bool current-parameters: Whether to include the parameters passed
|
||||
to the current build to the triggered job (optional)
|
||||
|
||||
Example::
|
||||
Example:
|
||||
|
||||
.. literalinclude:: ../../tests/publishers/fixtures/pipeline002.yaml
|
||||
|
||||
publishers:
|
||||
- pipeline: deploy
|
||||
|
||||
You can build pipeline jobs that are re-usable in different pipelines by
|
||||
using a :ref:`job-template` to define the pipeline jobs,
|
||||
@ -1175,11 +1179,27 @@ def pipeline(parser, xml_parent, data):
|
||||
|
||||
See 'samples/pipeline.yaml' for an example pipeline implementation.
|
||||
"""
|
||||
if data != '':
|
||||
if 'project' in data and data['project'] != '':
|
||||
pippub = XML.SubElement(xml_parent,
|
||||
'au.com.centrumsystems.hudson.plugin.'
|
||||
'buildpipeline.trigger.BuildPipelineTrigger')
|
||||
XML.SubElement(pippub, 'downstreamProjectNames').text = data
|
||||
|
||||
configs = XML.SubElement(pippub, 'configs')
|
||||
|
||||
if 'predefined-parameters' in data:
|
||||
params = XML.SubElement(configs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'PredefinedBuildParameters')
|
||||
properties = XML.SubElement(params, 'properties')
|
||||
properties.text = data['predefined-parameters']
|
||||
|
||||
if ('current-parameters' in data
|
||||
and data['current-parameters']):
|
||||
XML.SubElement(configs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'CurrentBuildParameters')
|
||||
|
||||
XML.SubElement(pippub, 'downstreamProjectNames').text = data['project']
|
||||
|
||||
|
||||
def email(parser, xml_parent, data):
|
||||
|
9
tests/publishers/fixtures/pipeline001.xml
Normal file
9
tests/publishers/fixtures/pipeline001.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project>
|
||||
<publishers>
|
||||
<au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
<configs/>
|
||||
<downstreamProjectNames>test_project</downstreamProjectNames>
|
||||
</au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
</publishers>
|
||||
</project>
|
3
tests/publishers/fixtures/pipeline001.yaml
Normal file
3
tests/publishers/fixtures/pipeline001.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
publishers:
|
||||
- pipeline:
|
||||
project: test_project
|
14
tests/publishers/fixtures/pipeline002.xml
Normal file
14
tests/publishers/fixtures/pipeline002.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project>
|
||||
<publishers>
|
||||
<au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
<configs>
|
||||
<hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
|
||||
<properties>foo=bar</properties>
|
||||
</hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
|
||||
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
|
||||
</configs>
|
||||
<downstreamProjectNames>test_project</downstreamProjectNames>
|
||||
</au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
</publishers>
|
||||
</project>
|
5
tests/publishers/fixtures/pipeline002.yaml
Normal file
5
tests/publishers/fixtures/pipeline002.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
publishers:
|
||||
- pipeline:
|
||||
project: test_project
|
||||
current-parameters: true
|
||||
predefined-parameters: foo=bar
|
Loading…
Reference in New Issue
Block a user