From d7c6fd8ea8c09105b0a8fd72477e0f269edeaf9a Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Mon, 25 Apr 2016 17:10:03 -0700 Subject: [PATCH] Update Google Cloud Storage publisher https://github.com/jenkinsci/google-storage-plugin/pull/12 added an option to allow uploaded objects (such as the build log) to be viewed inline in web browsers, rather than forcing them to be downloaded. This commit adds support for this option. Change-Id: Iae09db42d2c2f69add31f9de7819a22fe1cc1c6e --- jenkins_jobs/modules/publishers.py | 12 ++++++++++++ .../publishers/fixtures/google_cloud_storage002.xml | 3 +++ .../publishers/fixtures/google_cloud_storage003.xml | 4 ++++ .../publishers/fixtures/google_cloud_storage003.yaml | 2 ++ 4 files changed, 21 insertions(+) diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index e6738766e..9140aee95 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5193,6 +5193,9 @@ def google_cloud_storage(parser, xml_parent, data): share uploaded artifacts with everyone (default false) * **upload-for-failed-jobs** (`bool`) whether to upload artifacts even if the build fails (default false) + * **show-inline** (`bool`) whether to show uploaded build + log inline in web browsers, rather than forcing it to be + downloaded (default true) * **strip-prefix** (`str`) strip this prefix off the file names (default: not set) @@ -5206,6 +5209,9 @@ def google_cloud_storage(parser, xml_parent, data): share uploaded artifacts with everyone (default false) * **upload-for-failed-jobs** (`bool`) whether to upload artifacts even if the build fails (default false) + * **show-inline** (`bool`) whether to show uploaded + artifacts inline in web browsers, rather than forcing + them to be downloaded (default false) * **strip-prefix** (`str`) strip this prefix off the file names (default: not set) @@ -5268,6 +5274,9 @@ def google_cloud_storage(parser, xml_parent, data): XML.SubElement(xml_element, 'forFailedJobs').text = str( properties.get('upload-for-failed-jobs', False)).lower() + XML.SubElement(xml_element, 'showInline').text = str( + properties.get('show-inline', True)).lower() + XML.SubElement(xml_element, 'pathPrefix').text = str( properties.get('strip-prefix', '')) @@ -5301,6 +5310,9 @@ def google_cloud_storage(parser, xml_parent, data): XML.SubElement(xml_element, 'forFailedJobs').text = str( properties.get('upload-for-failed-jobs', False)).lower() + XML.SubElement(xml_element, 'showInline').text = str( + properties.get('show-inline', False)).lower() + XML.SubElement(xml_element, 'pathPrefix').text = str( properties.get('strip-prefix', '')) diff --git a/tests/publishers/fixtures/google_cloud_storage002.xml b/tests/publishers/fixtures/google_cloud_storage002.xml index e627b2087..41cd498c6 100644 --- a/tests/publishers/fixtures/google_cloud_storage002.xml +++ b/tests/publishers/fixtures/google_cloud_storage002.xml @@ -15,6 +15,7 @@ gs://myBucket true true + true console.log @@ -23,6 +24,7 @@ gs://myBucket false true + false target/*.war @@ -31,6 +33,7 @@ gs://myBucket/artifacts/ true false + false path/to/ **/build/*.iso diff --git a/tests/publishers/fixtures/google_cloud_storage003.xml b/tests/publishers/fixtures/google_cloud_storage003.xml index c5beecb6b..41040839b 100644 --- a/tests/publishers/fixtures/google_cloud_storage003.xml +++ b/tests/publishers/fixtures/google_cloud_storage003.xml @@ -15,6 +15,7 @@ gs://myBucket true true + false path/to/ console.log @@ -23,6 +24,7 @@ gs://myBucket false false + false path/to/ target/*.war @@ -38,6 +40,7 @@ gs://myBucket/artifacts/ false false + true path/to/ console.log @@ -46,6 +49,7 @@ gs://myBucket/artifacts/ true true + true path/to/ target/*.war diff --git a/tests/publishers/fixtures/google_cloud_storage003.yaml b/tests/publishers/fixtures/google_cloud_storage003.yaml index de2baedc3..62c75e7b7 100644 --- a/tests/publishers/fixtures/google_cloud_storage003.yaml +++ b/tests/publishers/fixtures/google_cloud_storage003.yaml @@ -10,6 +10,7 @@ publishers: storage-location: 'gs://myBucket' share-publicly: 'true' upload-for-failed-jobs: 'true' + show-inline: 'false' strip-prefix: 'path/to/' - classic: file-pattern: 'target/*.war' @@ -27,4 +28,5 @@ publishers: storage-location: 'gs://myBucket/artifacts/' share-publicly: 'true' upload-for-failed-jobs: 'true' + show-inline: 'true' strip-prefix: 'path/to/'