jenkinsci / google-storage-plugin

This plugin provides the “Google Cloud Storage Uploader” post-build step for publishing build artifacts to Google Cloud Storage.
https://plugins.jenkins.io/google-storage-plugin/
Apache License 2.0
31 stars 57 forks source link

Make Upload and Download Steps into Custom Steps #104

Open jphartley opened 5 years ago

jphartley commented 5 years ago

The Google Cloud Storage Plugin offers a build step to upload and download files to and from Google Storage during a build. The current integration of the plugin with Pipeline syntax is sub-optimal since it uses a generic step instead of a custom named step

step([
  $class: 'ClassicUploadStep', 
  credentialsId: env.CREDENTIALS_ID,  
  bucket: "gs://${env.BUCKET}",
  pattern: env.PATTERN
]) 

This should be relatively straightforward to fix simply by annotating the descriptor of the step with @Symbol('nameOfStep'). This will modify it so that a generic step isn't required and it will then also have the benefit that it will immediately start working for declarative pipelines.

batmat commented 5 years ago

cc @craigdbarber for visibility, thanks!

craigdbarber commented 5 years ago

Thanks for the feedback. We already are using this annotation: https://github.com/jenkinsci/google-storage-plugin/blob/38f46ec054b2f529ebbd93677f7d3feb136f9ab5/src/main/java/com/google/jenkins/plugins/storage/DownloadStep.java#L462 https://github.com/jenkinsci/google-storage-plugin/blob/38f46ec054b2f529ebbd93677f7d3feb136f9ab5/src/main/java/com/google/jenkins/plugins/storage/ClassicUploadStep.java#L191