Class GitHubHookRegisterProblemMonitor

java.lang.Object
hudson.model.AbstractModelObject
hudson.model.AdministrativeMonitor
org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor
All Implemented Interfaces:
ExtensionPoint, ModelObject, Saveable, SearchableModelObject, SearchItem, org.kohsuke.stapler.StaplerProxy

@Extension public class GitHubHookRegisterProblemMonitor extends AdministrativeMonitor implements Saveable
Administrative monitor to track problems of registering/removing hooks for GH. Holds non-savable map of repo->message and persisted list of ignored projects. Anyone can register new problem with registerProblem(GitHubRepositoryName, Throwable) and check repo for problems with isProblemWith(GitHubRepositoryName) Has own page with table with problems and ignoring list in global management section. Link to this page is visible if any problem or ignored repo is registered
Since:
1.17.0
Author:
lanwen (Merkushev Kirill)
  • Constructor Details

    • GitHubHookRegisterProblemMonitor

      public GitHubHookRegisterProblemMonitor()
  • Method Details

    • getProblems

      public Map<GitHubRepositoryName,String> getProblems()
      Returns:
      Immutable copy of map with repo->problem message content
    • registerProblem

      public void registerProblem(GitHubRepositoryName repo, Throwable throwable)
      Registers problems. For message Throwable.getMessage() will be used
      Parameters:
      repo - full named GitHub repo, if null nothing will be done
      throwable - exception with message about problem, if null nothing will be done
      See Also:
      • registerProblem(GitHubRepositoryName, String)
    • resolveProblem

      public void resolveProblem(GitHubRepositoryName repo)
      Removes repo from known problems map
      Parameters:
      repo - full named GitHub repo, if null nothing will be done
    • isProblemWith

      public boolean isProblemWith(GitHubRepositoryName repo)
      Checks that repo is registered in this monitor
      Parameters:
      repo - full named GitHub repo
      Returns:
      true if repo is in the map
    • getIgnored

      public List<GitHubRepositoryName> getIgnored()
      Returns:
      immutable copy of list with ignored repos
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
      Overrides:
      getDisplayName in class AdministrativeMonitor
    • isActivated

      public boolean isActivated()
      Specified by:
      isActivated in class AdministrativeMonitor
    • doAct

      public org.kohsuke.stapler.HttpResponse doAct(org.kohsuke.stapler.StaplerRequest req) throws IOException
      Depending on whether the user said "yes" or "no", send them to the right place.
      Throws:
      IOException
    • doIgnore

      public void doIgnore(@NonNull @GHRepoName GitHubRepositoryName repo)
      This web method requires POST, admin rights and nonnull repo. Responds with redirect to monitor page
      Parameters:
      repo - to be ignored. Never null
    • doDisignore

      public void doDisignore(@NonNull @GHRepoName GitHubRepositoryName repo)
      This web method requires POST, admin rights and nonnull repo. Responds with redirect to monitor page
      Parameters:
      repo - to be disignored. Never null
    • save

      public void save()
      Save the settings to a file. Called on each change of ignored list
      Specified by:
      save in interface Saveable
    • get

      public static GitHubHookRegisterProblemMonitor get()
      Returns:
      instance of administrative monitor to register/resolve/ignore/check hook problems