From 8fed481867c826057e54526093dcccfe0fbe379c Mon Sep 17 00:00:00 2001 From: spalger Date: Tue, 15 May 2018 15:26:24 -0700 Subject: [PATCH] Fix dontWaitForConcurrentBuildCompletion option in s3 plugin Story: 2002042 Change-Id: Ied3dbc06a586ec2d39227207458f92d15c8240d5 --- jenkins_jobs/modules/publishers.py | 14 ++++++++------ tests/publishers/fixtures/s3001.xml | 2 +- tests/publishers/fixtures/s3001.yaml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 7a5ef21f7..67beafb90 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5199,6 +5199,9 @@ def s3(registry, xml_parent, data): Requires the Jenkins :jenkins-wiki:`S3 plugin `. :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: :entries: * **destination-bucket** (`str`) - Destination S3 bucket @@ -5219,9 +5222,6 @@ def s3(registry, xml_parent, data): * **flatten** (`bool`) - Ignore the directory structure of the artifacts in the source project and copy all matching artifacts 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: :metadata-tags: * **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'): 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') entries = XML.SubElement(deployer, 'entries') @@ -5255,9 +5259,7 @@ def s3(registry, xml_parent, data): ('uploadFromSlave', 'upload-from-slave', False), ('managedArtifacts', 'managed-artifacts', False), ('useServerSideEncryption', 's3-encryption', False), - ('flatten', 'flatten', False), - ('dontWaitForConcurrentBuildCompletion', - 'dont-wait-for-concurrent-builds', False)] + ('flatten', 'flatten', False)] for xml_key, yaml_key, default in settings: xml_config = XML.SubElement(fileset, xml_key) diff --git a/tests/publishers/fixtures/s3001.xml b/tests/publishers/fixtures/s3001.xml index 81a397282..7058deba0 100644 --- a/tests/publishers/fixtures/s3001.xml +++ b/tests/publishers/fixtures/s3001.xml @@ -2,6 +2,7 @@ + true banana @@ -14,7 +15,6 @@ true true true - true diff --git a/tests/publishers/fixtures/s3001.yaml b/tests/publishers/fixtures/s3001.yaml index 663a9735a..c16c9c49b 100644 --- a/tests/publishers/fixtures/s3001.yaml +++ b/tests/publishers/fixtures/s3001.yaml @@ -1,6 +1,7 @@ publishers: - s3: s3-profile: banana + dont-wait-for-concurrent-builds: true entries: - destination-bucket: herp-derp source-files: 'bargle_${BUILD_ID}.tgz' @@ -11,7 +12,6 @@ publishers: managed-artifacts: true s3-encryption: true flatten: true - dont-wait-for-concurrent-builds: true metadata-tags: - key: warbl ${garbl} value: herp derp weevils