Add support of 'somewhereElse' value to Copy to slave plugin

Since copy to slave plugin version 1.4 (released on January 2012),
an additional value 'somewherElse' is permited for "paths are relative to"
option.

Relevant bug and commit:
https://issues.jenkins-ci.org/browse/JENKINS-12281
74f4fc505b

Additional changes: re-order alphabetically the options as the plugin
itself does.

Change-Id: Ie0f738120e0fb95c9826d61871e6bdda461b5b5a
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
This commit is contained in:
Fathi Boudra 2015-10-25 11:33:50 +02:00 committed by Thanh Ha
parent 9830b00a48
commit 3a04f7fe7d
No known key found for this signature in database
GPG Key ID: B0CB27E00DA095AA
5 changed files with 55 additions and 15 deletions

View File

@ -651,23 +651,25 @@ def copy_to_slave(parser, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Copy To Slave Plugin
<Copy+To+Slave+Plugin>`.
:arg list includes: list of file patterns to copy
:arg list excludes: list of file patterns to exclude
:arg bool flatten: flatten directory structure
:arg str relative-to: base location of includes/excludes,
must be userContent ($JENKINS_HOME/userContent)
home ($JENKINS_HOME) or workspace
:arg list includes: list of file patterns to copy (optional)
:arg list excludes: list of file patterns to exclude (optional)
:arg bool flatten: flatten directory structure (Default: False)
:arg str relative-to: base location of includes/excludes, must be home
($JENKINS_HOME), somewhereElse ($JENKINS_HOME/copyToSlave),
userContent ($JENKINS_HOME/userContent) or workspace
(Default: userContent)
:arg bool include-ant-excludes: exclude ant's default excludes
(Default: False)
Example::
Minimal Example:
wrappers:
- copy-to-slave:
includes:
- file1
- file2*.txt
excludes:
- file2bad.txt
.. literalinclude:: /../../tests/wrappers/fixtures/copy-to-slave001.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/wrappers/fixtures/copy-to-slave002.yaml
:language: yaml
"""
p = 'com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper'
cs = XML.SubElement(xml_parent, p)
@ -680,7 +682,7 @@ def copy_to_slave(parser, xml_parent, data):
str(data.get('include-ant-excludes', False)).lower()
rel = str(data.get('relative-to', 'userContent'))
opt = ('userContent', 'home', 'workspace')
opt = ('home', 'somewhereElse', 'userContent', 'workspace')
if rel not in opt:
raise ValueError('relative-to must be one of %r' % opt)
XML.SubElement(cs, 'relativeTo').text = rel

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
<includes/>
<excludes/>
<flatten>false</flatten>
<includeAntExcludes>false</includeAntExcludes>
<relativeTo>userContent</relativeTo>
<hudsonHomeRelative>false</hudsonHomeRelative>
</com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,2 @@
wrappers:
- copy-to-slave

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
<includes>file1,file2*.txt</includes>
<excludes>file2bad.txt</excludes>
<flatten>true</flatten>
<includeAntExcludes>true</includeAntExcludes>
<relativeTo>somewhereElse</relativeTo>
<hudsonHomeRelative>false</hudsonHomeRelative>
</com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,10 @@
wrappers:
- copy-to-slave:
includes:
- 'file1'
- 'file2*.txt'
excludes:
- 'file2bad.txt'
flatten: True
relative-to: 'somewhereElse'
include-ant-excludes: True