Added "Downstream build of" build selector

jjb copyartifact missing "Downstream build of" build selector
the build selector introduced in CopyArtifact plugin v1.32

Change-Id: Ia0ae5036610c44b88ad75efd9e0a314d0a26eff7
story: 2000437
This commit is contained in:
Dong Ma 2015-12-14 12:49:44 +08:00
parent 959eb4b909
commit 85395266a7
4 changed files with 43 additions and 1 deletions

View File

@ -115,6 +115,7 @@ def copyartifact(parser, xml_parent, data):
* **permalink**
* **workspace-latest**
* **build-param**
* **downstream-build**
:arg str build-number: specifies the build number to get when
when specific-build is specified as which-build
@ -135,6 +136,11 @@ def copyartifact(parser, xml_parent, data):
last successful build when upstream-build is specified as which-build
:arg string param: specifies to use a build parameter to get the build when
build-param is specified as which-build
:arg str upstream-project-name: specifies the project name of downstream
when downstream-build is specified as which-build
:arg str upstream-build-number: specifies the number of the build to
find its downstream build when downstream-build is specified as
which-build
:arg string parameter-filters: Filter matching jobs based on these
parameters (optional)

View File

@ -172,7 +172,8 @@ def copyartifact_build_selector(xml_parent, data, select_tag='selector'):
'upstream-build': 'TriggeredBuildSelector',
'permalink': 'PermalinkBuildSelector',
'workspace-latest': 'WorkspaceSelector',
'build-param': 'ParameterizedBuildSelector'}
'build-param': 'ParameterizedBuildSelector',
'downstream-build': 'DownstreamBuildSelector'}
if select not in selectdict:
raise InvalidAttributeError('which-build',
select,
@ -203,6 +204,11 @@ def copyartifact_build_selector(xml_parent, data, select_tag='selector'):
XML.SubElement(selector, 'id').text = permalinkdict[permalink]
if select == 'build-param':
XML.SubElement(selector, 'parameterName').text = data['param']
if select == 'downstream-build':
XML.SubElement(selector, 'upstreamProjectName').text = (
data['upstream-project-name'])
XML.SubElement(selector, 'upstreamBuildNumber').text = (
data['upstream-build-number'])
def findbugs_settings(xml_parent, data):

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.copyartifact.CopyArtifact>
<project>foo</project>
<filter>*.tar.gz</filter>
<target>/home/foo</target>
<flatten>true</flatten>
<optional>true</optional>
<doNotFingerprintArtifacts>true</doNotFingerprintArtifacts>
<parameters>PUBLISH=true</parameters>
<selector class="hudson.plugins.copyartifact.DownstreamBuildSelector">
<upstreamProjectName>bar</upstreamProjectName>
<upstreamBuildNumber>123</upstreamBuildNumber>
</selector>
</hudson.plugins.copyartifact.CopyArtifact>
</builders>
</project>

View File

@ -0,0 +1,12 @@
builders:
- copyartifact:
project: foo
filter: "*.tar.gz"
target: /home/foo
which-build: downstream-build
upstream-project-name: bar
upstream-build-number: "123"
optional: true
flatten: true
do-not-fingerprint: true
parameter-filters: PUBLISH=true