Fix dontWaitForConcurrentBuildCompletion option in s3 plugin

Story: 2002042
Change-Id: Ied3dbc06a586ec2d39227207458f92d15c8240d5
This commit is contained in:
spalger 2018-05-15 15:26:24 -07:00
parent afd7cc8475
commit 8fed481867
3 changed files with 10 additions and 8 deletions

View File

@ -5199,6 +5199,9 @@ def s3(registry, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`S3 plugin <S3+Plugin>`. Requires the Jenkins :jenkins-wiki:`S3 plugin <S3+Plugin>`.
:arg str s3-profile: Globally-defined S3 profile to use :arg str s3-profile: Globally-defined S3 profile to use
:arg bool dont-wait-for-concurrent-builds: Don't wait
for completion of concurrent builds before publishing to S3
(default false)
:arg list entries: :arg list entries:
:entries: :entries:
* **destination-bucket** (`str`) - Destination S3 bucket * **destination-bucket** (`str`) - Destination S3 bucket
@ -5219,9 +5222,6 @@ def s3(registry, xml_parent, data):
* **flatten** (`bool`) - Ignore the directory structure of the * **flatten** (`bool`) - Ignore the directory structure of the
artifacts in the source project and copy all matching artifacts artifacts in the source project and copy all matching artifacts
directly into the specified bucket. (default false) directly into the specified bucket. (default false)
* **dont-wait-for-concurrent-builds** (`bool`) - Don't wait
for completion of concurrent builds before publishing to S3
(default false)
:arg list metadata-tags: :arg list metadata-tags:
:metadata-tags: :metadata-tags:
* **key** Metadata key for files from this build. It will be * **key** Metadata key for files from this build. It will be
@ -5239,6 +5239,10 @@ def s3(registry, xml_parent, data):
if data is None or not data.get('entries'): if data is None or not data.get('entries'):
raise JenkinsJobsException('No filesets defined.') raise JenkinsJobsException('No filesets defined.')
XML.SubElement(deployer, 'dontWaitForConcurrentBuildCompletion').text = (
str(data.get('dont-wait-for-concurrent-builds', False)).lower()
)
XML.SubElement(deployer, 'profileName').text = data.get('s3-profile') XML.SubElement(deployer, 'profileName').text = data.get('s3-profile')
entries = XML.SubElement(deployer, 'entries') entries = XML.SubElement(deployer, 'entries')
@ -5255,9 +5259,7 @@ def s3(registry, xml_parent, data):
('uploadFromSlave', 'upload-from-slave', False), ('uploadFromSlave', 'upload-from-slave', False),
('managedArtifacts', 'managed-artifacts', False), ('managedArtifacts', 'managed-artifacts', False),
('useServerSideEncryption', 's3-encryption', False), ('useServerSideEncryption', 's3-encryption', False),
('flatten', 'flatten', False), ('flatten', 'flatten', False)]
('dontWaitForConcurrentBuildCompletion',
'dont-wait-for-concurrent-builds', False)]
for xml_key, yaml_key, default in settings: for xml_key, yaml_key, default in settings:
xml_config = XML.SubElement(fileset, xml_key) xml_config = XML.SubElement(fileset, xml_key)

View File

@ -2,6 +2,7 @@
<project> <project>
<publishers> <publishers>
<hudson.plugins.s3.S3BucketPublisher> <hudson.plugins.s3.S3BucketPublisher>
<dontWaitForConcurrentBuildCompletion>true</dontWaitForConcurrentBuildCompletion>
<profileName>banana</profileName> <profileName>banana</profileName>
<entries> <entries>
<hudson.plugins.s3.Entry> <hudson.plugins.s3.Entry>
@ -14,7 +15,6 @@
<managedArtifacts>true</managedArtifacts> <managedArtifacts>true</managedArtifacts>
<useServerSideEncryption>true</useServerSideEncryption> <useServerSideEncryption>true</useServerSideEncryption>
<flatten>true</flatten> <flatten>true</flatten>
<dontWaitForConcurrentBuildCompletion>true</dontWaitForConcurrentBuildCompletion>
</hudson.plugins.s3.Entry> </hudson.plugins.s3.Entry>
</entries> </entries>
<userMetadata> <userMetadata>

View File

@ -1,6 +1,7 @@
publishers: publishers:
- s3: - s3:
s3-profile: banana s3-profile: banana
dont-wait-for-concurrent-builds: true
entries: entries:
- destination-bucket: herp-derp - destination-bucket: herp-derp
source-files: 'bargle_${BUILD_ID}.tgz' source-files: 'bargle_${BUILD_ID}.tgz'
@ -11,7 +12,6 @@ publishers:
managed-artifacts: true managed-artifacts: true
s3-encryption: true s3-encryption: true
flatten: true flatten: true
dont-wait-for-concurrent-builds: true
metadata-tags: metadata-tags:
- key: warbl ${garbl} - key: warbl ${garbl}
value: herp derp weevils value: herp derp weevils