Adding property-file into the pipeline publisher
This commit is adding suport for the property_file option of the pipeline publisher. It's based on the code from the trigger_parameterized_builds publisher. Change-Id: I7961c3ee4ec21d0ba20b963d8c90afd2503415ef Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
This commit is contained in:
parent
fda76531d9
commit
3f99401fe0
|
@ -1696,12 +1696,23 @@ def pipeline(parser, xml_parent, data):
|
|||
job (optional)
|
||||
:arg bool current-parameters: Whether to include the parameters passed
|
||||
to the current build to the triggered job (optional)
|
||||
:arg str property-file: Use properties from file (optional)
|
||||
:arg bool fail-on-missing: Blocks the triggering of the downstream jobs
|
||||
if any of the property files are not found in the workspace.
|
||||
Only valid when 'property-file' is specified.
|
||||
(default false)
|
||||
:arg str file-encoding: Encoding of contents of the files. If not
|
||||
specified, default encoding of the platform is used. Only valid when
|
||||
'property-file' is specified. (optional)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/pipeline002.yaml
|
||||
:language: yaml
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/pipeline003.yaml
|
||||
:language: yaml
|
||||
|
||||
|
||||
You can build pipeline jobs that are re-usable in different pipelines by
|
||||
using a :ref:`job-template` to define the pipeline jobs,
|
||||
|
@ -1731,6 +1742,19 @@ def pipeline(parser, xml_parent, data):
|
|||
'hudson.plugins.parameterizedtrigger.'
|
||||
'CurrentBuildParameters')
|
||||
|
||||
if 'property-file' in data and data['property-file']:
|
||||
params = XML.SubElement(configs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'FileBuildParameters')
|
||||
properties = XML.SubElement(params, 'propertiesFile')
|
||||
properties.text = data['property-file']
|
||||
failOnMissing = XML.SubElement(params, 'failTriggerOnMissing')
|
||||
failOnMissing.text = str(
|
||||
data.get('fail-on-missing', False)).lower()
|
||||
if 'file-encoding' in data:
|
||||
XML.SubElement(params, 'encoding'
|
||||
).text = data['file-encoding']
|
||||
|
||||
XML.SubElement(pippub, 'downstreamProjectNames').text = data['project']
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
<configs>
|
||||
<hudson.plugins.parameterizedtrigger.FileBuildParameters>
|
||||
<propertiesFile>vars.txt</propertiesFile>
|
||||
<failTriggerOnMissing>true</failTriggerOnMissing>
|
||||
<encoding>UTF-8</encoding>
|
||||
</hudson.plugins.parameterizedtrigger.FileBuildParameters>
|
||||
</configs>
|
||||
<downstreamProjectNames>test_project</downstreamProjectNames>
|
||||
</au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger>
|
||||
</publishers>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
publishers:
|
||||
- pipeline:
|
||||
project: test_project
|
||||
property-file: vars.txt
|
||||
fail-on-missing: true
|
||||
file-encoding: UTF-8
|
Loading…
Reference in New Issue