Class GithubBuildNotifier

java.lang.Object
org.jenkinsci.plugins.githubautostatus.notifiers.BuildNotifier
org.jenkinsci.plugins.githubautostatus.notifiers.GithubBuildNotifier
All Implemented Interfaces:
ExtensionPoint

public class GithubBuildNotifier extends BuildNotifier
Sets the GitHub commit status for stages based on build notifications.
Author:
Jeff Pearce (GitHub jeffpearce)
  • Constructor Details

    • GithubBuildNotifier

      public GithubBuildNotifier(org.kohsuke.github.GHRepository repository, String shaString, String targetUrl)
      Constructor
      Parameters:
      repository - the GitHub repository
      shaString - the commit notifications are being provided for
      targetUrl - target Url (link back to Jenkins)
    • GithubBuildNotifier

      public GithubBuildNotifier(org.kohsuke.github.GHRepository repository, String shaString, String targetUrl, GithubNotificationConfig config)
      Constructor with config for credential refresh support.
      Parameters:
      repository - the GitHub repository
      shaString - the commit notifications are being provided for
      targetUrl - target Url (link back to Jenkins)
      config - config for re-resolving credentials when tokens expire
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Determines whether this notifier is enabled.
      Specified by:
      isEnabled in class BuildNotifier
      Returns:
      true if enabled; false otherwise
    • notifyBuildStageStatus

      public void notifyBuildStageStatus(String jobName, BuildStage stageItem)
      Sends stage status notification to GitHub.
      Specified by:
      notifyBuildStageStatus in class BuildNotifier
      Parameters:
      jobName - the job name (used in failure logging, not in the createCommitStatus call)
      stageItem - stage item describing the new state; its name is used as the optional state, and its name is used as the optional context for GHRepository.createCommitStatus(String, GHCommitState, String, String, String) ultimate call.
    • notifyFinalBuildStatus

      public void notifyFinalBuildStatus(BuildStage.State buildState, Map<String,Object> parameters)
      Sends a notification when the job is complete (currently no-op in this class).
      Specified by:
      notifyFinalBuildStatus in class BuildNotifier
      Parameters:
      buildState - state indicating success or failure
      parameters - build parameters