@RequiresDomain(value=StorageScopeRequirement.class) public class DownloadStep extends hudson.tasks.Builder implements jenkins.tasks.SimpleBuildStep, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DownloadStep.DescriptorImpl
Descriptor for the DownloadStep
|
protected static class |
DownloadStep.StorageObjectId
A class to store StorageObject information in a serializable manner.
|
jenkins.tasks.SimpleBuildStep.LastBuildAction, jenkins.tasks.SimpleBuildStep.LastBuildActionFactory
Constructor and Description |
---|
DownloadStep(String credentialsId,
String bucketUri,
String localDirectory)
DataBoundConstructor for DownloadStep.
|
DownloadStep(String credentialsId,
String bucketUri,
String localDirectory,
UploadModule module)
Constructor for DownloadStep.
|
Modifier and Type | Method and Description |
---|---|
String |
getBucketUri() |
com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials |
getCredentials() |
String |
getCredentialsId() |
DownloadStep.DescriptorImpl |
getDescriptor() |
String |
getLocalDirectory() |
protected UploadModule |
getModule() |
String |
getPathPrefix() |
hudson.tasks.BuildStepMonitor |
getRequiredMonitorService() |
void |
perform(hudson.model.Run<?,?> run,
hudson.FilePath workspace,
hudson.Launcher launcher,
hudson.model.TaskListener listener)
The main entry point of this extension.
|
void |
setPathPrefix(String pathPrefix) |
static String[] |
split(String uri)
Split the string on wildcards ("*").
|
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
@DataBoundConstructor public DownloadStep(String credentialsId, String bucketUri, String localDirectory)
credentialsId
- The unique ID for the credentials we are using to authenticate with GCS.bucketUri
- Name of the GCS bucket. e.g. gs://MY_BUCKET_NAMElocalDirectory
- Path of the local directory in Jenkins to download the file to.public DownloadStep(String credentialsId, String bucketUri, String localDirectory, @Nullable UploadModule module)
credentialsId
- The unique ID for the credentials we are using to authenticate with GCS.bucketUri
- Name of the GCS bucket. e.g. gs://MY_BUCKET_NAMElocalDirectory
- Path of the local directory in Jenkins to download the file to.module
- An UploadModule
to use for execution.public String getBucketUri()
public String getLocalDirectory()
@DataBoundSetter public void setPathPrefix(@Nullable String pathPrefix)
pathPrefix
- The path prefix that will be stripped from downloaded files. May be null if
no path prefix needs to be stripped.
Filenames that do not start with this prefix will not be modified. Trailing slash is automatically added if it is missing.
@Nullable public String getPathPrefix()
Filenames that do not start with this prefix will not be modified. Trailing slash is automatically added if it is missing.
protected UploadModule getModule()
public String getCredentialsId()
public com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials getCredentials()
public hudson.tasks.BuildStepMonitor getRequiredMonitorService()
getRequiredMonitorService
in interface hudson.tasks.BuildStep
getRequiredMonitorService
in class hudson.tasks.Builder
public void perform(@Nonnull hudson.model.Run<?,?> run, @Nonnull hudson.FilePath workspace, @Nonnull hudson.Launcher launcher, @Nonnull hudson.model.TaskListener listener) throws IOException, InterruptedException
perform
in interface jenkins.tasks.SimpleBuildStep
run
- Current job being run.workspace
- Workspace of node running the job.launcher
- Launcher
for this job.listener
- Listener for events of this job.IOException
- If there was an issue parsing the bucket URI.InterruptedException
- If there was an issue initiating downloads at workspace or
expanding variables in the pathPrefix.public static String[] split(String uri) throws hudson.AbortException
String.split removes trailing empty strings, for example, "a", "a*" and "a**" and would produce the same result, so that method is not suitable.
uri
- URI supplied to be split.hudson.AbortException
- If there is more than one wild card character in the provided string.public DownloadStep.DescriptorImpl getDescriptor()
getDescriptor
in interface hudson.model.Describable<hudson.tasks.Builder>
getDescriptor
in class hudson.tasks.Builder
Copyright © 2016–2020. All rights reserved.