Adds support multijob support to the CopyArtifact plugin
Added the multijob-build keyword support to CopyArtifact helper and builder Change-Id: Id657ef072c049fa48d0e0a88bf3dec1a593f67d5
This commit is contained in:
parent
7d13236760
commit
8df564f97c
|
@ -96,6 +96,9 @@ def copyartifact(parser, xml_parent, data):
|
||||||
Copy artifact from another project. Requires the :jenkins-wiki:`Copy
|
Copy artifact from another project. Requires the :jenkins-wiki:`Copy
|
||||||
Artifact plugin <Copy+Artifact+Plugin>`.
|
Artifact plugin <Copy+Artifact+Plugin>`.
|
||||||
|
|
||||||
|
Please note using the multijob-build for which-build argument requires
|
||||||
|
the :jenkins-wiki:`Multijob plugin <Multijob+Plugin>`
|
||||||
|
|
||||||
:arg str project: Project to copy from
|
:arg str project: Project to copy from
|
||||||
:arg str filter: what files to copy
|
:arg str filter: what files to copy
|
||||||
:arg str target: Target base directory for copy, blank means use workspace
|
:arg str target: Target base directory for copy, blank means use workspace
|
||||||
|
@ -118,6 +121,7 @@ def copyartifact(parser, xml_parent, data):
|
||||||
* **workspace-latest**
|
* **workspace-latest**
|
||||||
* **build-param**
|
* **build-param**
|
||||||
* **downstream-build**
|
* **downstream-build**
|
||||||
|
* **multijob-build**
|
||||||
|
|
||||||
:arg str build-number: specifies the build number to get when
|
:arg str build-number: specifies the build number to get when
|
||||||
when specific-build is specified as which-build
|
when specific-build is specified as which-build
|
||||||
|
@ -151,6 +155,11 @@ def copyartifact(parser, xml_parent, data):
|
||||||
|
|
||||||
.. literalinclude:: ../../tests/builders/fixtures/copy-artifact001.yaml
|
.. literalinclude:: ../../tests/builders/fixtures/copy-artifact001.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
|
|
||||||
|
Multijob Example:
|
||||||
|
|
||||||
|
.. literalinclude:: ../../tests/builders/fixtures/copy-artifact004.yaml
|
||||||
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
t = XML.SubElement(xml_parent, 'hudson.plugins.copyartifact.CopyArtifact')
|
t = XML.SubElement(xml_parent, 'hudson.plugins.copyartifact.CopyArtifact')
|
||||||
# Warning: this only works with copy artifact version 1.26+,
|
# Warning: this only works with copy artifact version 1.26+,
|
||||||
|
|
|
@ -197,7 +197,8 @@ def copyartifact_build_selector(xml_parent, data, select_tag='selector'):
|
||||||
'permalink': 'PermalinkBuildSelector',
|
'permalink': 'PermalinkBuildSelector',
|
||||||
'workspace-latest': 'WorkspaceSelector',
|
'workspace-latest': 'WorkspaceSelector',
|
||||||
'build-param': 'ParameterizedBuildSelector',
|
'build-param': 'ParameterizedBuildSelector',
|
||||||
'downstream-build': 'DownstreamBuildSelector'}
|
'downstream-build': 'DownstreamBuildSelector',
|
||||||
|
'multijob-build': 'MultiJobBuildSelector'}
|
||||||
if select not in selectdict:
|
if select not in selectdict:
|
||||||
raise InvalidAttributeError('which-build',
|
raise InvalidAttributeError('which-build',
|
||||||
select,
|
select,
|
||||||
|
@ -213,9 +214,16 @@ def copyartifact_build_selector(xml_parent, data, select_tag='selector'):
|
||||||
raise InvalidAttributeError('permalink',
|
raise InvalidAttributeError('permalink',
|
||||||
permalink,
|
permalink,
|
||||||
permalinkdict.keys())
|
permalinkdict.keys())
|
||||||
selector = XML.SubElement(xml_parent, select_tag,
|
if select == 'multijob-build':
|
||||||
{'class': 'hudson.plugins.copyartifact.' +
|
selector = XML.SubElement(xml_parent, select_tag,
|
||||||
selectdict[select]})
|
{'class':
|
||||||
|
'com.tikal.jenkins.plugins.multijob.' +
|
||||||
|
selectdict[select]})
|
||||||
|
else:
|
||||||
|
selector = XML.SubElement(xml_parent, select_tag,
|
||||||
|
{'class':
|
||||||
|
'hudson.plugins.copyartifact.' +
|
||||||
|
selectdict[select]})
|
||||||
if select == 'specific-build':
|
if select == 'specific-build':
|
||||||
XML.SubElement(selector, 'buildNumber').text = data['build-number']
|
XML.SubElement(selector, 'buildNumber').text = data['build-number']
|
||||||
if select == 'last-successful':
|
if select == 'last-successful':
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<builders>
|
||||||
|
<hudson.plugins.copyartifact.CopyArtifact>
|
||||||
|
<project>foo</project>
|
||||||
|
<filter>*.json</filter>
|
||||||
|
<target>/home/foo</target>
|
||||||
|
<flatten>true</flatten>
|
||||||
|
<optional>true</optional>
|
||||||
|
<doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
|
||||||
|
<parameters>PUBLISH=true</parameters>
|
||||||
|
<selector class="com.tikal.jenkins.plugins.multijob.MultiJobBuildSelector"/>
|
||||||
|
</hudson.plugins.copyartifact.CopyArtifact>
|
||||||
|
</builders>
|
||||||
|
</project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
builders:
|
||||||
|
- copyartifact:
|
||||||
|
project: foo
|
||||||
|
filter: "*.json"
|
||||||
|
target: /home/foo
|
||||||
|
which-build: multijob-build
|
||||||
|
optional: true
|
||||||
|
flatten: true
|
||||||
|
parameter-filters: PUBLISH=true
|
Loading…
Reference in New Issue