Update copy-to-slave plugin

- update copy-to-slave plugin to use convert xml
- update docstring
- add plugin="copy-to-slave" attribute
- add new parameter 'run-after-result'

Change-Id: I2e2b67c8b12f494c274668b28d7c962e8abd8ce5
This commit is contained in:
Dong Ma 2016-10-08 05:55:39 -07:00
parent b56481cf8c
commit 741f315b26
3 changed files with 17 additions and 10 deletions

View File

@ -2177,8 +2177,10 @@ def copy_to_master(registry, xml_parent, data):
:arg list includes: list of file patterns to copy
:arg list excludes: list of file patterns to exclude
:arg string destination: absolute path into which the files will be copied.
If left blank they will be copied into the
workspace of the current job
If left blank they will be copied into the workspace of the current job
(default '')
:arg bool run-after-result: If this is checked then copying files back to
master will not run until the build result is finalized.(default true)
Example:
@ -2186,14 +2188,17 @@ def copy_to_master(registry, xml_parent, data):
/../../tests/publishers/fixtures/copy-to-master001.yaml
:language: yaml
"""
p = 'com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier'
cm = XML.SubElement(xml_parent, p)
cm = XML.SubElement(xml_parent, 'com.michelin.'
'cio.hudson.plugins.copytoslave.CopyToMasterNotifier')
cm.set('plugin', 'copy-to-slave')
XML.SubElement(cm, 'includes').text = ','.join(data.get('includes', ['']))
XML.SubElement(cm, 'excludes').text = ','.join(data.get('excludes', ['']))
XML.SubElement(cm, 'destinationFolder').text = \
data.get('destination', '')
mappings = [
('run-after-result', 'runAfterResultFinalised', True),
('destination', 'destinationFolder', '')
]
helpers.convert_mapping_to_xml(cm, data, mappings, fail_required=True)
if data.get('destination', ''):
XML.SubElement(cm, 'overrideDestinationFolder').text = 'true'

View File

@ -8,9 +8,10 @@
<command>ls file*</command>
</condition>
<runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$DontRun"/>
<publisher class="com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier">
<publisher class="com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier" plugin="copy-to-slave">
<includes>file1,file2*.txt</includes>
<excludes>file2bad.txt</excludes>
<runAfterResultFinalised>true</runAfterResultFinalised>
<destinationFolder/>
</publisher>
</org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
@ -24,4 +25,4 @@
</publishers>
</org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
</publishers>
</project>
</project>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier>
<com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier plugin="copy-to-slave">
<includes>file1,file2*.txt</includes>
<excludes>file2bad.txt</excludes>
<runAfterResultFinalised>true</runAfterResultFinalised>
<destinationFolder/>
</com.michelin.cio.hudson.plugins.copytoslave.CopyToMasterNotifier>
</publishers>