Class StashNotifier
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Publisher
hudson.tasks.Notifier
org.jenkinsci.plugins.stashNotifier.StashNotifier
- All Implemented Interfaces:
ExtensionPoint,Describable<Publisher>,BuildStep,SimpleBuildStep
Notifies a configured Atlassian Bitbucket server instance of build results
through the Bitbucket build API.
Only basic authentication is supported at the moment.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImplNested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherListNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.client.methods.HttpPostcreateRequest(org.apache.http.HttpEntity stashBuildNotificationEntity, Item project, String commitSha1, String url) Deprecated.in favor of method overloadprotected StringgetBuildDescription(Run<?, ?> run, StashBuildState state) Returns the description of the run used for the Bitbucket notification.protected StringgetBuildKey(Run<?, ?> run, TaskListener listener) Returns the run key used in the Bitbucket notification.protected StringgetBuildName(Run<?, ?> run) Returns the build name to be pushed.protected StringgetBuildUrl(Run<?, ?> run) Returns the build url to be pushed.protected org.apache.http.impl.client.CloseableHttpClientgetHttpClient(PrintStream logger, Run<?, ?> run, String stashServer) Deprecated.protected StashBuildStategetPushedBuildStatus(StashBuildState currentBuildStatus) Returns the build state to be pushed.booleanbooleanbooleanbooleanbooleanprotected Collection<String>lookupCommitSha1s(Run run, FilePath workspace, TaskListener listener) protected NotificationResultnotifyStash(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.booleanperform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) voidperform(Run<?, ?> run, EnvVars env, TaskListener listener) booleanprebuild(AbstractBuild<?, ?> build, BuildListener listener) booleanvoidsetBuildName(String buildName) voidsetBuildStatus(Object buildStatus) voidsetBuildUrl(String buildUrl) voidsetCommitSha1(String commitSha1) voidsetConsiderUnstableAsSuccess(boolean considerUnstableAsSuccess) voidsetCredentialsId(String credentialsId) voidsetDisableInprogressNotification(boolean disableInprogressNotification) voidsetIgnoreUnverifiedSSLPeer(boolean ignoreUnverifiedSSLPeer) voidsetIncludeBuildNumberInKey(boolean includeBuildNumberInKey) voidsetPrependParentProjectKey(boolean prependParentProjectKey) voidsetProjectKey(String projectKey) voidsetStashServerBaseUrl(String stashServerBaseUrl) Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, performMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActionsMethods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform
-
Field Details
-
MAX_FIELD_LENGTH
public static final int MAX_FIELD_LENGTH- See Also:
-
MAX_URL_FIELD_LENGTH
public static final int MAX_URL_FIELD_LENGTH- See Also:
-
-
Constructor Details
-
StashNotifier
@DataBoundConstructor public StashNotifier()
-
-
Method Details
-
getRequiredMonitorService
- Specified by:
getRequiredMonitorServicein interfaceBuildStep
-
getStashServerBaseUrl
-
setStashServerBaseUrl
-
getCredentialsId
-
setCredentialsId
-
isIgnoreUnverifiedSSLPeer
public boolean isIgnoreUnverifiedSSLPeer() -
setIgnoreUnverifiedSSLPeer
@DataBoundSetter public void setIgnoreUnverifiedSSLPeer(boolean ignoreUnverifiedSSLPeer) -
getCommitSha1
-
setCommitSha1
-
getBuildStatus
-
setBuildStatus
-
getBuildName
-
setBuildName
-
getBuildUrl
-
setBuildUrl
-
isIncludeBuildNumberInKey
public boolean isIncludeBuildNumberInKey() -
setIncludeBuildNumberInKey
@DataBoundSetter public void setIncludeBuildNumberInKey(boolean includeBuildNumberInKey) -
getProjectKey
-
setProjectKey
-
isPrependParentProjectKey
public boolean isPrependParentProjectKey() -
setPrependParentProjectKey
@DataBoundSetter public void setPrependParentProjectKey(boolean prependParentProjectKey) -
isDisableInprogressNotification
public boolean isDisableInprogressNotification() -
setDisableInprogressNotification
@DataBoundSetter public void setDisableInprogressNotification(boolean disableInprogressNotification) -
isConsiderUnstableAsSuccess
public boolean isConsiderUnstableAsSuccess() -
setConsiderUnstableAsSuccess
@DataBoundSetter public void setConsiderUnstableAsSuccess(boolean considerUnstableAsSuccess) -
prebuild
- Specified by:
prebuildin interfaceBuildStep- Overrides:
prebuildin classBuildStepCompatibilityLayer
-
requiresWorkspace
public boolean requiresWorkspace()- Specified by:
requiresWorkspacein interfaceSimpleBuildStep
-
perform
- Specified by:
performin interfaceBuildStep- Overrides:
performin classBuildStepCompatibilityLayer
-
perform
- Specified by:
performin interfaceSimpleBuildStep
-
lookupCommitSha1s
-
getHttpClient
@Deprecated protected org.apache.http.impl.client.CloseableHttpClient getHttpClient(PrintStream logger, Run<?, ?> run, String stashServer) throws ExceptionDeprecated.Returns the HttpClient through which the REST call is made. Uses an unsafe TrustStrategy in case the user specified a HTTPS URL and set the ignoreUnverifiedSSLPeer flag.- Throws:
Exception- See Also:
-
DefaultApacheHttpNotifier.getHttpClient(PrintStream, URI, boolean)
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Publisher>- Overrides:
getDescriptorin classNotifier
-
notifyStash
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.- Parameters:
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.
-
getPushedBuildStatus
Returns the build state to be pushed. This will select the specifically overwritten build state or the current build state else.- Parameters:
currentBuildStatus- the state of the current build- Returns:
- the current build status
-
createRequest
protected org.apache.http.client.methods.HttpPost createRequest(org.apache.http.HttpEntity stashBuildNotificationEntity, Item project, String commitSha1, String url) throws org.apache.http.auth.AuthenticationException Deprecated.in favor of method overloadReturns the HTTP POST request ready to be sent to the Bitbucket build API for the given run and change set.- Parameters:
stashBuildNotificationEntity- a entity containing the parameters for BitbucketcommitSha1- the SHA1 of the commit that was builturl- Bitbucket URL- Returns:
- the HTTP POST request to the Bitbucket build API
- Throws:
org.apache.http.auth.AuthenticationException- See Also:
-
DefaultApacheHttpNotifier.createRequest(URI, JSONObject, Credentials, NotificationContext)
-
getBuildKey
Returns the run key used in the Bitbucket notification. Includes the run number depending on the user setting.- Parameters:
run- the run to notify Bitbucket of- Returns:
- the run key for the Bitbucket notification
-
getBuildName
Returns the build name to be pushed. This will select the specifically overwritten build name or get the build name from theRun.- Parameters:
run- the run to notify Bitbucket of- Returns:
- the name of the run
-
getBuildUrl
Returns the build url to be pushed. This will select the specifically overwritten build url or get the build url from theDisplayURLProvider.- Parameters:
run- the run to notify Bitbucket of- Returns:
- the url of the run
-
getBuildDescription
Returns the description of the run used for the Bitbucket notification. Uses the run description provided by the Jenkins job, if available.- Parameters:
run- the run to be describedstate- the state of the run- Returns:
- the description of the run
-