diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index cb995c31d..422b8189b 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -651,23 +651,25 @@ def copy_to_slave(parser, xml_parent, data): Requires the Jenkins :jenkins-wiki:`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 diff --git a/tests/wrappers/fixtures/copy-to-slave001.xml b/tests/wrappers/fixtures/copy-to-slave001.xml new file mode 100644 index 000000000..d870a35a7 --- /dev/null +++ b/tests/wrappers/fixtures/copy-to-slave001.xml @@ -0,0 +1,13 @@ + + + + + + + false + false + userContent + false + + + \ No newline at end of file diff --git a/tests/wrappers/fixtures/copy-to-slave001.yaml b/tests/wrappers/fixtures/copy-to-slave001.yaml new file mode 100644 index 000000000..0745a28cd --- /dev/null +++ b/tests/wrappers/fixtures/copy-to-slave001.yaml @@ -0,0 +1,2 @@ +wrappers: + - copy-to-slave \ No newline at end of file diff --git a/tests/wrappers/fixtures/copy-to-slave002.xml b/tests/wrappers/fixtures/copy-to-slave002.xml new file mode 100644 index 000000000..97455dac4 --- /dev/null +++ b/tests/wrappers/fixtures/copy-to-slave002.xml @@ -0,0 +1,13 @@ + + + + + file1,file2*.txt + file2bad.txt + true + true + somewhereElse + false + + + \ No newline at end of file diff --git a/tests/wrappers/fixtures/copy-to-slave002.yaml b/tests/wrappers/fixtures/copy-to-slave002.yaml new file mode 100644 index 000000000..1644d3f74 --- /dev/null +++ b/tests/wrappers/fixtures/copy-to-slave002.yaml @@ -0,0 +1,10 @@ +wrappers: + - copy-to-slave: + includes: + - 'file1' + - 'file2*.txt' + excludes: + - 'file2bad.txt' + flatten: True + relative-to: 'somewhereElse' + include-ant-excludes: True