Class BasePRGHEventSubscriber<T extends TriggerBranchProperty,U>

java.lang.Object
org.jenkinsci.plugins.github.extension.GHEventsSubscriber
com.adobe.jenkins.github_pr_comment_build.BasePRGHEventSubscriber<T,U>
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
CheckRunGHEventSubscriber, IssueCommentGHEventSubscriber, IssueLabelGHEventSubscriber, PRReviewGHEventSubscriber, PRUpdateGHEventSubscriber

public abstract class BasePRGHEventSubscriber<T extends TriggerBranchProperty,U> extends org.jenkinsci.plugins.github.extension.GHEventsSubscriber
Base subscriber for PR events.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface hudson.ExtensionPoint

    ExtensionPoint.LegacyInstancesAreScopedToHudson
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Logger
    Logger.
    protected static final Pattern
    Regex pattern for a GitHub repository.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    checkAndRunJobs(com.cloudbees.jenkins.GitHubRepositoryName changedRepository, int pullRequestId, String author, U postStartParam, BiFunction<Job<?,?>,T,Cause> getCauseFunction)
    onEvent() (and therefore this method) runs directly on the thread handling GitHub's webhook HTTP request (see GitHubWebHook.doIndex() in github-plugin) - it must not block.
    protected com.cloudbees.jenkins.GitHubRepositoryName
     
    protected String
    getRepoUrl(net.sf.json.JSONObject json)
     
    protected abstract Class<T>
     
    protected boolean
     
    protected void
    postStartJob(T branchProp, Job<?,?> job, U postStartParam)
    Called after a job is started successfully, may be used for adding reactions or performing other actions.

    Methods inherited from class org.jenkinsci.plugins.github.extension.GHEventsSubscriber

    all, events, extractEvents, isApplicable, isApplicableFor, isApplicableFor, isInterestedIn, onEvent, onEvent, processEvent, processEvent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
      Logger.
    • REPOSITORY_NAME_PATTERN

      protected static final Pattern REPOSITORY_NAME_PATTERN
      Regex pattern for a GitHub repository.
  • Constructor Details

    • BasePRGHEventSubscriber

      public BasePRGHEventSubscriber()
  • Method Details

    • getTriggerClass

      protected abstract Class<T> getTriggerClass()
    • isApplicable

      protected boolean isApplicable(Item item)
      Specified by:
      isApplicable in class org.jenkinsci.plugins.github.extension.GHEventsSubscriber
    • getRepoUrl

      protected String getRepoUrl(net.sf.json.JSONObject json)
    • getChangedRepository

      protected com.cloudbees.jenkins.GitHubRepositoryName getChangedRepository(String repoUrl)
    • postStartJob

      protected void postStartJob(T branchProp, Job<?,?> job, U postStartParam)
      Called after a job is started successfully, may be used for adding reactions or performing other actions.
      Parameters:
      branchProp - the branch property
      job - the job
      postStartParam - an arbitrary parameter
    • checkAndRunJobs

      protected void checkAndRunJobs(com.cloudbees.jenkins.GitHubRepositoryName changedRepository, int pullRequestId, String author, U postStartParam, BiFunction<Job<?,?>,T,Cause> getCauseFunction)
      onEvent() (and therefore this method) runs directly on the thread handling GitHub's webhook HTTP request (see GitHubWebHook.doIndex() in github-plugin) - it must not block. The initial match attempt is synchronous (cheap, in-memory), but the rescan-and-retry path is scheduled on Timer.get() and returns immediately, so a slow indexing pass never holds up the webhook response or ties up an HTTP-handling thread.