Class BuildStatusAction

java.lang.Object
hudson.model.InvisibleAction
org.jenkinsci.plugins.githubautostatus.BuildStatusAction
All Implemented Interfaces:
Action, ModelObject, Serializable

public class BuildStatusAction extends InvisibleAction implements 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 Details

  • Constructor Details

  • Method Details

    • getJobName

      public String getJobName()
    • getRepoOwner

      public String getRepoOwner()
    • setRepoOwner

      public void setRepoOwner(String repoOwner)
    • getRepoName

      public String getRepoName()
    • setRepoName

      public void setRepoName(String repoName)
    • getBranchName

      public String getBranchName()
    • setBranchName

      public void setBranchName(String branchName)
    • newAction

      public static BuildStatusAction newAction(Run<?,?> run, String targetUrl, List<BuildStage> stageList)
      Construct a BuildStatusAction
      Parameters:
      run - the build
      targetUrl - link back to Jenkins
      stageList - list of stages if known
    • connectNotifiers

      public void connectNotifiers(Run<?,?> run, String targetUrl)
      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 build
      targetUrl - 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

      public void addGithubNotifier(GithubNotificationConfig config)
      Attempts to add a GitHub notifier.
      Parameters:
      config - GitHub notifier config
    • addInfluxDbNotifier

      public void addInfluxDbNotifier(InfluxDbNotifierConfig influxDbNotifierConfig)
      Attempts to add an InfluxDB notifier.
      Parameters:
      influxDbNotifierConfig - InfluxDB notifier config
    • addStatsdNotifier

      public void addStatsdNotifier(StatsdNotifierConfig statsdNotifierConfig)
      Attempts to add a StatsD notifier.
      Parameters:
      statsdNotifierConfig - StatsD notifier config
    • addHttpNotifier

      public void addHttpNotifier(HttpNotifierConfig httpNotifierConfig)
      Attempts to add an HTTP notifier.
      Parameters:
      httpNotifierConfig - HTTP notifier config
    • addGenericNotifier

      public void addGenericNotifier(BuildNotifier notifier)
    • sendNotifications

      public void sendNotifications(BuildNotifier notifier)
      Sends all saved notifications to a notifier.
      Parameters:
      notifier - notifier to send to
    • addBuildStatus

      public void addBuildStatus(String stageName)
      Sends pending notifications for the start of a stage.
      Parameters:
      stageName - stage name
    • updateBuildStatusForStage

      public void updateBuildStatusForStage(String nodeName, BuildStage.State buildState, long time)
      Sends notifications for a completed stage.
      Parameters:
      nodeName - node name
      buildState - build state
      time - stage time
    • updateBuildStatusForStage

      public void updateBuildStatusForStage(String nodeName, BuildStage.State buildState)
      Sends notifications for a completed stage.
      Parameters:
      nodeName - node name
      buildState - build state
    • updateBuildStatusForJob

      public void updateBuildStatusForJob(BuildStage.State buildState, Map<String,Object> parameters)
      Sends notifications for final build status.
      Parameters:
      buildState - final build state
      parameters - build parameters
    • sendNonStageError

      public void sendNonStageError(String nodeName)
      Sends notifications for an error that happens outside of a stage.
      Parameters:
      nodeName - name of node that failed