public class EnvironmentTagBuilder
extends hudson.tasks.Builder
Builder
tags the specified environment with a given version
number.
When the user configures the project and enable this builder,
Descriptor.newInstance(StaplerRequest)
is invoked and a new
EnvironmentTagBuilder
is created. The created instance is persisted
to the project configuration XML by using XStream, so this allows you to use
instance fields (like credentials
) to remember the configuration.
When a build is performed, the
BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener)
method will be invoked.
Modifier and Type | Class and Description |
---|---|
static class |
EnvironmentTagBuilder.DescriptorImpl
Descriptor for
EnvironmentTagBuilder . |
Constructor and Description |
---|
EnvironmentTagBuilder(String credentials,
String region)
This annotation tells Hudson to call this constructor, with values from
the configuration form page with matching parameter names.
|
Modifier and Type | Method and Description |
---|---|
String |
getCredentials() |
EnvironmentTagBuilder.DescriptorImpl |
getDescriptor()
Hudson defines a method
Builder.getDescriptor() , which returns
the corresponding Descriptor object. |
String |
getRegion() |
boolean |
perform(hudson.model.AbstractBuild build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
We'll use this from the config.jelly.
|
void |
setCredentials(String credentials) |
void |
setRegion(String region) |
@DataBoundConstructor public EnvironmentTagBuilder(String credentials, String region)
credentials
- reference to Jenkins AWS credentialsregion
- reference to AWS regionpublic String getCredentials()
public void setCredentials(String credentials)
public String getRegion()
public void setRegion(String region)
public boolean perform(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
perform
in interface hudson.tasks.BuildStep
perform
in class hudson.tasks.BuildStepCompatibilityLayer
public EnvironmentTagBuilder.DescriptorImpl getDescriptor()
Builder.getDescriptor()
, which returns
the corresponding Descriptor
object.
Since we know that it's actually EnvironmentTagBuilder.DescriptorImpl
, override the
method and give a better return type, so that we can access
EnvironmentTagBuilder.DescriptorImpl
methods more easily.
This is not necessary, but just a coding style preference.getDescriptor
in interface hudson.model.Describable<hudson.tasks.Builder>
getDescriptor
in class hudson.tasks.Builder
Copyright © 2004-2015. All Rights Reserved.