public class StashNotifier extends Notifier implements SimpleBuildStep
Only basic authentication is supported at the moment.
| Modifier and Type | Class and Description |
|---|---|
static class |
StashNotifier.DescriptorImpl |
Publisher.DescriptorExtensionListImplSimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactoryBuildStep.PublisherListExtensionPoint.LegacyInstancesAreScopedToHudson| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_FIELD_LENGTH |
static int |
MAX_URL_FIELD_LENGTH |
BUILDERS, PUBLISHERS| Constructor and Description |
|---|
StashNotifier(String stashServerBaseUrl,
String credentialsId,
boolean ignoreUnverifiedSSLPeer,
String commitSha1,
String buildStatus,
String buildName,
boolean includeBuildNumberInKey,
String projectKey,
boolean prependParentProjectKey,
boolean disableInprogressNotification,
boolean considerUnstableAsSuccess) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.client.methods.HttpPost |
createRequest(org.apache.http.HttpEntity stashBuildNotificationEntity,
Item project,
String commitSha1,
String url)
Returns the HTTP POST request ready to be sent to the Bitbucket build API for
the given run and change set.
|
protected String |
getBuildDescription(Run<?,?> run,
StashBuildState state)
Returns the description of the run used for the Bitbucket notification.
|
protected String |
getBuildKey(Run<?,?> run,
TaskListener listener)
Returns the run key used in the Bitbucket notification.
|
String |
getBuildName() |
protected String |
getBuildName(Run<?,?> run)
Returns the build name to be pushed.
|
StashBuildState |
getBuildStatus() |
String |
getCommitSha1() |
String |
getCredentialsId() |
StashNotifier.DescriptorImpl |
getDescriptor() |
protected org.apache.http.impl.client.CloseableHttpClient |
getHttpClient(PrintStream logger,
Run<?,?> run,
String stashServer)
Returns the HttpClient through which the REST call is made.
|
boolean |
getIgnoreUnverifiedSSLPeer() |
boolean |
getIncludeBuildNumberInKey() |
boolean |
getPrependParentProjectKey() |
String |
getProjectKey() |
protected StashBuildState |
getPushedBuildStatus(StashBuildState currentBuildStatus)
Returns the build state to be pushed.
|
BuildStepMonitor |
getRequiredMonitorService() |
String |
getStashServerBaseUrl() |
boolean |
isConsiderUnstableAsSuccess() |
boolean |
isDisableInprogressNotification() |
protected Collection<String> |
lookupCommitSha1s(Run run,
FilePath workspace,
TaskListener listener) |
protected <C extends com.cloudbees.plugins.credentials.Credentials> |
lookupCredentials(Class<C> type,
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,
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,
Run<?,?> run,
String commitSha1,
TaskListener listener,
StashBuildState state)
Notifies the configured Bitbucket server by POSTing the run results
to the Bitbucket run API.
|
boolean |
perform(AbstractBuild<?,?> build,
Launcher launcher,
BuildListener listener) |
void |
perform(Run<?,?> run,
FilePath workspace,
Launcher launcher,
TaskListener listener) |
boolean |
prebuild(AbstractBuild<?,?> build,
BuildListener listener) |
all, getProjectAction, needsToRunAfterFinalized, prebuildgetProjectAction, getProjectActions, performclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProjectAction, getProjectActionspublic static final int MAX_FIELD_LENGTH
public static final int MAX_URL_FIELD_LENGTH
@DataBoundConstructor public StashNotifier(String stashServerBaseUrl, String credentialsId, boolean ignoreUnverifiedSSLPeer, String commitSha1, String buildStatus, String buildName, boolean includeBuildNumberInKey, String projectKey, boolean prependParentProjectKey, boolean disableInprogressNotification, boolean considerUnstableAsSuccess)
public BuildStepMonitor getRequiredMonitorService()
getRequiredMonitorService in interface BuildSteppublic boolean isDisableInprogressNotification()
public boolean isConsiderUnstableAsSuccess()
public String getCredentialsId()
public String getStashServerBaseUrl()
public boolean getIgnoreUnverifiedSSLPeer()
public String getCommitSha1()
public StashBuildState getBuildStatus()
public String getBuildName()
public boolean getIncludeBuildNumberInKey()
public String getProjectKey()
public boolean getPrependParentProjectKey()
public boolean prebuild(AbstractBuild<?,?> build, BuildListener listener)
prebuild in interface BuildStepprebuild in class BuildStepCompatibilityLayerpublic boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
perform in interface BuildStepperform in class BuildStepCompatibilityLayerpublic void perform(@Nonnull Run<?,?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException
perform in interface SimpleBuildStepInterruptedExceptionIOExceptionprotected Collection<String> lookupCommitSha1s(Run run, FilePath workspace, TaskListener listener)
protected org.apache.http.impl.client.CloseableHttpClient getHttpClient(PrintStream logger, Run<?,?> run, String stashServer) throws Exception
Exceptionpublic StashNotifier.DescriptorImpl getDescriptor()
getDescriptor in interface Describable<Publisher>getDescriptor in class Notifierprotected NotificationResult notifyStash(PrintStream logger, Run<?,?> run, String commitSha1, TaskListener listener, StashBuildState state) throws Exception
logger - the logger to userun - the run to notify Bitbucket ofcommitSha1 - the SHA1 of the run commitlistener - the run listener for loggingstate - the state of the build as defined by the Bitbucket API.Exceptionprotected <C extends com.cloudbees.plugins.credentials.Credentials> List<C> lookupCredentials(Class<C> type, 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, 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 StashBuildState getPushedBuildStatus(StashBuildState currentBuildStatus)
currentBuildStatus - the state of the current buildprotected org.apache.http.client.methods.HttpPost createRequest(org.apache.http.HttpEntity stashBuildNotificationEntity,
Item project,
String commitSha1,
String url)
throws org.apache.http.auth.AuthenticationException
stashBuildNotificationEntity - a entity containing the parameters for BitbucketcommitSha1 - the SHA1 of the commit that was builturl - org.apache.http.auth.AuthenticationExceptionprotected String getBuildKey(Run<?,?> run, TaskListener listener)
run - the run to notify Bitbucket ofprotected String getBuildName(Run<?,?> run)
Run.run - the run to notify Bitbucket ofprotected String getBuildDescription(Run<?,?> run, StashBuildState state)
run - the run to be describedstate - the state of the runCopyright © 2016–2019. All rights reserved.