upd google-cloud-storage plugin support

- add support for pathPrefix support
  - with tests
    - defined strip-prefix
    - undefined strip-prefix

Change-Id: I53288da0ad40ec486c2ed00c9d6306abad096992
Signed-off-by: Max Kovgan <kovganm@gmail.com>
This commit is contained in:
Max Kovgan 2016-03-03 01:08:09 +02:00 committed by Max V.K.
parent 8c03c692ec
commit bd796dbfbc
5 changed files with 23 additions and 0 deletions

View File

@ -5157,6 +5157,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)
* **strip-prefix** (`str`) strip this prefix off the
file names (default: not set)
* **classic** (`dict`)
:params:
* **file-pattern** (`str`) ant style globs to match the
@ -5167,6 +5170,8 @@ 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)
* **strip-prefix** (`str`) strip this prefix off the
file names (default: not set)
Example:
@ -5227,6 +5232,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, 'pathPrefix').text = str(
properties.get('strip-prefix', ''))
if types.count('build-log') > 1:
XML.SubElement(xml_element, 'module',
{'reference': '../../com.google.jenkins.plugins.'
@ -5257,6 +5265,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, 'pathPrefix').text = str(
properties.get('strip-prefix', ''))
if types.count('classic') > 1:
XML.SubElement(xml_element, 'module',
{'reference': '../../com.google.jenkins.plugins.'

View File

@ -15,6 +15,7 @@
<bucketNameWithVars>gs://myBucket</bucketNameWithVars>
<sharedPublicly>true</sharedPublicly>
<forFailedJobs>true</forFailedJobs>
<pathPrefix/>
<module/>
<logName>console.log</logName>
</com.google.jenkins.plugins.storage.StdoutUpload>
@ -22,6 +23,7 @@
<bucketNameWithVars>gs://myBucket</bucketNameWithVars>
<sharedPublicly>false</sharedPublicly>
<forFailedJobs>true</forFailedJobs>
<pathPrefix/>
<module/>
<sourceGlobWithVars>target/*.war</sourceGlobWithVars>
</com.google.jenkins.plugins.storage.ClassicUpload>
@ -29,6 +31,7 @@
<bucketNameWithVars>gs://myBucket/artifacts/</bucketNameWithVars>
<sharedPublicly>true</sharedPublicly>
<forFailedJobs>false</forFailedJobs>
<pathPrefix>path/to/</pathPrefix>
<module reference="../../com.google.jenkins.plugins.storage.ClassicUpload/module"/>
<sourceGlobWithVars>**/build/*.iso</sourceGlobWithVars>
</com.google.jenkins.plugins.storage.ClassicUpload>

View File

@ -18,3 +18,4 @@ publishers:
file-pattern: '**/build/*.iso'
storage-location: 'gs://myBucket/artifacts/'
share-publicly: true
strip-prefix: 'path/to/'

View File

@ -15,6 +15,7 @@
<bucketNameWithVars>gs://myBucket</bucketNameWithVars>
<sharedPublicly>true</sharedPublicly>
<forFailedJobs>true</forFailedJobs>
<pathPrefix>path/to/</pathPrefix>
<module/>
<logName>console.log</logName>
</com.google.jenkins.plugins.storage.StdoutUpload>
@ -22,6 +23,7 @@
<bucketNameWithVars>gs://myBucket</bucketNameWithVars>
<sharedPublicly>false</sharedPublicly>
<forFailedJobs>false</forFailedJobs>
<pathPrefix>path/to/</pathPrefix>
<module/>
<sourceGlobWithVars>target/*.war</sourceGlobWithVars>
</com.google.jenkins.plugins.storage.ClassicUpload>
@ -36,6 +38,7 @@
<bucketNameWithVars>gs://myBucket/artifacts/</bucketNameWithVars>
<sharedPublicly>false</sharedPublicly>
<forFailedJobs>false</forFailedJobs>
<pathPrefix>path/to/</pathPrefix>
<module reference="../../com.google.jenkins.plugins.storage.StdoutUpload/module"/>
<logName>console.log</logName>
</com.google.jenkins.plugins.storage.StdoutUpload>
@ -43,6 +46,7 @@
<bucketNameWithVars>gs://myBucket/artifacts/</bucketNameWithVars>
<sharedPublicly>true</sharedPublicly>
<forFailedJobs>true</forFailedJobs>
<pathPrefix>path/to/</pathPrefix>
<module reference="../../com.google.jenkins.plugins.storage.ClassicUpload/module"/>
<sourceGlobWithVars>target/*.war</sourceGlobWithVars>
</com.google.jenkins.plugins.storage.ClassicUpload>

View File

@ -10,17 +10,21 @@ publishers:
storage-location: 'gs://myBucket'
share-publicly: 'true'
upload-for-failed-jobs: 'true'
strip-prefix: 'path/to/'
- classic:
file-pattern: 'target/*.war'
storage-location: 'gs://myBucket'
strip-prefix: 'path/to/'
- expiring-elements:
bucket-name: 'gs://myBucket/artifacts/'
days-to-retain: 7
- build-log:
log-name: 'console.log'
storage-location: 'gs://myBucket/artifacts/'
strip-prefix: 'path/to/'
- classic:
file-pattern: 'target/*.war'
storage-location: 'gs://myBucket/artifacts/'
share-publicly: 'true'
upload-for-failed-jobs: 'true'
strip-prefix: 'path/to/'