public class StashNotifier
extends hudson.tasks.Notifier
implements jenkins.tasks.SimpleBuildStep
Only basic authentication is supported at the moment.
| Modifier and Type | Class and Description |
|---|---|
static class |
StashNotifier.DescriptorImpl |
hudson.tasks.Publisher.DescriptorExtensionListImpljenkins.tasks.SimpleBuildStep.LastBuildAction, jenkins.tasks.SimpleBuildStep.LastBuildActionFactory| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_FIELD_LENGTH |
static int |
MAX_URL_FIELD_LENGTH |
| Constructor and Description |
|---|
StashNotifier(String stashServerBaseUrl,
String credentialsId,
boolean ignoreUnverifiedSSLPeer,
String commitSha1,
boolean includeBuildNumberInKey,
String projectKey,
boolean prependParentProjectKey,
boolean disableInprogressNotification) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.client.methods.HttpPost |
createRequest(org.apache.http.HttpEntity stashBuildNotificationEntity,
hudson.model.Item project,
String commitSha1)
Returns the HTTP POST request ready to be sent to the Stash build API for
the given run and change set.
|
protected String |
getBuildDescription(hudson.model.Run<?,?> run,
StashBuildState state)
Returns the description of the run used for the Stash notification.
|
protected String |
getBuildKey(hudson.model.Run<?,?> run,
hudson.model.TaskListener listener)
Returns the run key used in the Stash notification.
|
String |
getCommitSha1() |
String |
getCredentialsId() |
StashNotifier.DescriptorImpl |
getDescriptor() |
protected org.apache.http.client.HttpClient |
getHttpClient(PrintStream logger,
hudson.model.Run<?,?> run)
Returns the HttpClient through which the REST call is made.
|
boolean |
getIgnoreUnverifiedSSLPeer() |
boolean |
getIncludeBuildNumberInKey() |
boolean |
getPrependParentProjectKey() |
String |
getProjectKey() |
hudson.tasks.BuildStepMonitor |
getRequiredMonitorService() |
String |
getStashServerBaseUrl() |
boolean |
isDisableInprogressNotification() |
protected Collection<String> |
lookupCommitSha1s(hudson.model.Run run,
hudson.model.TaskListener listener) |
protected <C extends com.cloudbees.plugins.credentials.Credentials> |
lookupCredentials(Class<C> type,
hudson.model.Item item,
org.acegisecurity.Authentication authentication,
ArrayList<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements)
Returns all credentials which are available to the specified
Authentication
for use by the specified Item. |
protected <C extends com.cloudbees.plugins.credentials.Credentials> |
lookupCredentials(Class<C> type,
hudson.model.ItemGroup<?> itemGroup,
org.acegisecurity.Authentication authentication,
ArrayList<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements)
Returns all credentials which are available to the specified
Authentication
for use by the specified Item. |
protected NotificationResult |
notifyStash(PrintStream logger,
hudson.model.Run<?,?> run,
String commitSha1,
hudson.model.TaskListener listener,
StashBuildState state)
Notifies the configured Stash server by POSTing the run results
to the Stash run API.
|
boolean |
perform(hudson.model.AbstractBuild<?,?> build,
hudson.Launcher launcher,
hudson.model.BuildListener listener) |
void |
perform(hudson.model.Run<?,?> run,
hudson.FilePath workspace,
hudson.Launcher launcher,
hudson.model.TaskListener listener) |
boolean |
prebuild(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener) |
all, getProjectAction, needsToRunAfterFinalized, prebuildgetProjectAction, getProjectActions, performpublic static final int MAX_FIELD_LENGTH
public static final int MAX_URL_FIELD_LENGTH
public hudson.tasks.BuildStepMonitor getRequiredMonitorService()
getRequiredMonitorService in interface hudson.tasks.BuildSteppublic boolean isDisableInprogressNotification()
public String getCredentialsId()
public String getStashServerBaseUrl()
public boolean getIgnoreUnverifiedSSLPeer()
public String getCommitSha1()
public boolean getIncludeBuildNumberInKey()
public String getProjectKey()
public boolean getPrependParentProjectKey()
public boolean prebuild(hudson.model.AbstractBuild<?,?> build,
hudson.model.BuildListener listener)
prebuild in interface hudson.tasks.BuildStepprebuild in class hudson.tasks.BuildStepCompatibilityLayerpublic boolean perform(hudson.model.AbstractBuild<?,?> build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
perform in interface hudson.tasks.BuildStepperform in class hudson.tasks.BuildStepCompatibilityLayerpublic void perform(@Nonnull hudson.model.Run<?,?> run, @Nonnull hudson.FilePath workspace, @Nonnull hudson.Launcher launcher, @Nonnull hudson.model.TaskListener listener) throws InterruptedException, IOException
perform in interface jenkins.tasks.SimpleBuildStepInterruptedExceptionIOExceptionprotected Collection<String> lookupCommitSha1s(hudson.model.Run run, hudson.model.TaskListener listener)
protected org.apache.http.client.HttpClient getHttpClient(PrintStream logger, hudson.model.Run<?,?> run) throws Exception
logger - the logger to log messages torun - Exceptionpublic StashNotifier.DescriptorImpl getDescriptor()
getDescriptor in interface hudson.model.Describable<hudson.tasks.Publisher>getDescriptor in class hudson.tasks.Notifierprotected NotificationResult notifyStash(PrintStream logger, hudson.model.Run<?,?> run, String commitSha1, hudson.model.TaskListener listener, StashBuildState state) throws Exception
logger - the logger to userun - the run to notify Stash ofcommitSha1 - the SHA1 of the run commitlistener - the run listener for loggingstate - the state of the build as defined by the Stash API.Exceptionprotected <C extends com.cloudbees.plugins.credentials.Credentials> List<C> lookupCredentials(Class<C> type, hudson.model.Item item, org.acegisecurity.Authentication authentication, ArrayList<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements)
Authentication
for use by the specified Item.C - the credentials type.type - the type of credentials to get.authentication - the authentication.item - the item.domainRequirements - the credential domains to match.protected <C extends com.cloudbees.plugins.credentials.Credentials> List<C> lookupCredentials(Class<C> type, hudson.model.ItemGroup<?> itemGroup, org.acegisecurity.Authentication authentication, ArrayList<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements)
Authentication
for use by the specified Item.C - the credentials type.type - the type of credentials to get.authentication - the authentication.itemGroup - the item group.domainRequirements - the credential domains to match.protected org.apache.http.client.methods.HttpPost createRequest(org.apache.http.HttpEntity stashBuildNotificationEntity,
hudson.model.Item project,
String commitSha1)
throws org.apache.http.auth.AuthenticationException
stashBuildNotificationEntity - a entity containing the parameters
for StashcommitSha1 - the SHA1 of the commit that was builtorg.apache.http.auth.AuthenticationExceptionprotected String getBuildKey(hudson.model.Run<?,?> run, hudson.model.TaskListener listener)
run - the run to notify Stash ofprotected String getBuildDescription(hudson.model.Run<?,?> run, StashBuildState state)
run - the run to be describedstate - the state of the runCopyright © 2004-2016. All Rights Reserved.