Class BuildStatusAction
java.lang.Object
hudson.model.InvisibleAction
org.jenkinsci.plugins.githubautostatus.BuildStatusAction
- All Implemented Interfaces:
Action,ModelObject,Serializable
Keeps track of build status for each stage in a build, and provides
mechanisms for notifying various subscribers as stages and jobs are
completed.
- Author:
- Jeff Pearce (GitHub jeffpearce)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuildStatusAction(Run<?, ?> run, String targetUrl, List<BuildStage> stageList) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuildStatus(String stageName) Sends pending notifications for the start of a stage.voidaddGenericNotifier(BuildNotifier notifier) voidAttempts to add a GitHub notifier.voidaddHttpNotifier(HttpNotifierConfig httpNotifierConfig) Attempts to add an HTTP notifier.voidaddInfluxDbNotifier(InfluxDbNotifierConfig influxDbNotifierConfig) Attempts to add an InfluxDB notifier.voidaddStatsdNotifier(StatsdNotifierConfig statsdNotifierConfig) Attempts to add a StatsD notifier.voidclose()Cleans up by sending "complete" status to any steps that are currently pending.voidconnectNotifiers(Run<?, ?> run, String targetUrl) Determines whether the notifiers need to be reconnected.booleanSets flag indicating whether notifications are for a declarative pipelinestatic BuildStatusActionnewAction(Run<?, ?> run, String targetUrl, List<BuildStage> stageList) Construct a BuildStatusActionvoidsendNonStageError(String nodeName) Sends notifications for an error that happens outside of a stage.voidsendNotifications(BuildNotifier notifier) Sends all saved notifications to a notifier.voidsetBranchName(String branchName) voidsetIsDeclarativePipeline(boolean isDeclarativePipeline) voidsetRepoName(String repoName) voidsetRepoOwner(String repoOwner) voidupdateBuildStatusForJob(BuildStage.State buildState, Map<String, Object> parameters) Sends notifications for final build status.voidupdateBuildStatusForStage(String nodeName, BuildStage.State buildState) Sends notifications for a completed stage.voidupdateBuildStatusForStage(String nodeName, BuildStage.State buildState, long time) Sends notifications for a completed stage.Methods inherited from class hudson.model.InvisibleAction
getDisplayName, getIconFileName, getUrlName
-
Field Details
-
buildNotifierManager
-
-
Constructor Details
-
BuildStatusAction
-
-
Method Details
-
getJobName
-
getRepoOwner
-
setRepoOwner
-
getRepoName
-
setRepoName
-
getBranchName
-
setBranchName
-
newAction
public static BuildStatusAction newAction(Run<?, ?> run, String targetUrl, List<BuildStage> stageList) Construct a BuildStatusAction- Parameters:
run- the buildtargetUrl- link back to JenkinsstageList- list of stages if known
-
connectNotifiers
Determines whether the notifiers need to be reconnected. This is necessary because the GitHub notifier can't be serialized because of the JEP-200 security improvements. In the event the build is interrupted and the buildAction is loaded from disk, the notifiers need to be added again.- Parameters:
run- the current buildtargetUrl- link back to Jenkins
-
close
public void close()Cleans up by sending "complete" status to any steps that are currently pending. Needed because some complex jobs, particularly using down -
isIsDeclarativePipeline
public boolean isIsDeclarativePipeline()Sets flag indicating whether notifications are for a declarative pipeline- Returns:
- if pipeline is declarative or not
-
setIsDeclarativePipeline
public void setIsDeclarativePipeline(boolean isDeclarativePipeline) -
addGithubNotifier
Attempts to add a GitHub notifier.- Parameters:
config- GitHub notifier config
-
addInfluxDbNotifier
Attempts to add an InfluxDB notifier.- Parameters:
influxDbNotifierConfig- InfluxDB notifier config
-
addStatsdNotifier
Attempts to add a StatsD notifier.- Parameters:
statsdNotifierConfig- StatsD notifier config
-
addHttpNotifier
Attempts to add an HTTP notifier.- Parameters:
httpNotifierConfig- HTTP notifier config
-
addGenericNotifier
-
sendNotifications
Sends all saved notifications to a notifier.- Parameters:
notifier- notifier to send to
-
addBuildStatus
Sends pending notifications for the start of a stage.- Parameters:
stageName- stage name
-
updateBuildStatusForStage
Sends notifications for a completed stage.- Parameters:
nodeName- node namebuildState- build statetime- stage time
-
updateBuildStatusForStage
Sends notifications for a completed stage.- Parameters:
nodeName- node namebuildState- build state
-
updateBuildStatusForJob
Sends notifications for final build status.- Parameters:
buildState- final build stateparameters- build parameters
-
sendNonStageError
Sends notifications for an error that happens outside of a stage.- Parameters:
nodeName- name of node that failed
-