Class CommitDecoratorFactory

java.lang.Object
io.jenkins.plugins.forensics.util.CommitDecoratorFactory
All Implemented Interfaces:
ExtensionPoint

public abstract class CommitDecoratorFactory extends Object implements ExtensionPoint
Jenkins' extension point that allows plugins to create CommitDecorator instances based on a supported SCM and RepositoryBrowser.
Author:
Ullrich Hafner
  • Constructor Details

    • CommitDecoratorFactory

      public CommitDecoratorFactory()
  • Method Details

    • createCommitDecorator

      public abstract Optional<CommitDecorator> createCommitDecorator(SCM scm, edu.hm.hafner.util.FilteredLog logger)
      Returns a commit decorator for the specified SCM and the associated RepositoryBrowser.
      Parameters:
      scm - the SCM to create the commit decorator for
      logger - a logger to report error messages
      Returns:
      a commit decorator for the specified SCM and the associated RepositoryBrowser
    • findCommitDecorator

      public static CommitDecorator findCommitDecorator(SCM scm, edu.hm.hafner.util.FilteredLog logger)
      Returns a commit decorator for the specified scm.
      Parameters:
      scm - the SCM to get the decorator for
      logger - a logger to report error messages
      Returns:
      a commit decorator for the specified SCM or a CommitDecorator.NullDecorator if the SCM is not supported or if the SCM does not provide a RepositoryBrowser implementation
    • findCommitDecorator

      public static CommitDecorator findCommitDecorator(Run<?,?> run)
      Returns a commit decorator for the specified build.
      Parameters:
      run - the current build
      Returns:
      a commit decorator for the SCM of the specified build or a CommitDecorator.NullDecorator if the SCM is not supported or if the SCM does not provide a RepositoryBrowser implementation
    • findCommitDecorator

      public static CommitDecorator findCommitDecorator(Run<?,?> run, String scmKey)
      Returns a commit decorator for the specified build and SCM key. The SCM key is used to identify the correct SCM in case multiple SCMs are used (e.g., when Global Libraries are configured). This prevents using the wrong SCM's commit URLs (e.g., the Global Library's repository URLs instead of the actual project's URLs).
      Parameters:
      run - the current build
      scmKey - the key of the SCM to use (a substring of the full SCM key)
      Returns:
      a commit decorator for the matching SCM of the specified build or a CommitDecorator.NullDecorator if no matching SCM is found, the SCM is not supported, or the SCM does not provide a RepositoryBrowser implementation