Class CommitDecoratorFactory
java.lang.Object
io.jenkins.plugins.forensics.util.CommitDecoratorFactory
- All Implemented Interfaces:
ExtensionPoint
Jenkins' extension point that allows plugins to create
CommitDecorator instances based on a supported SCM and RepositoryBrowser.- Author:
- Ullrich Hafner
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Optional<CommitDecorator> createCommitDecorator(SCM scm, edu.hm.hafner.util.FilteredLog logger) Returns a commit decorator for the specifiedSCMand the associatedRepositoryBrowser.static CommitDecoratorfindCommitDecorator(Run<?, ?> run) Returns a commit decorator for the specifiedbuild.static CommitDecoratorfindCommitDecorator(Run<?, ?> run, String scmKey) Returns a commit decorator for the specifiedbuildand SCM key.static CommitDecoratorfindCommitDecorator(SCM scm, edu.hm.hafner.util.FilteredLog logger) Returns a commit decorator for the specifiedscm.
-
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 specifiedSCMand the associatedRepositoryBrowser.- Parameters:
scm- theSCMto create the commit decorator forlogger- a logger to report error messages- Returns:
- a commit decorator for the specified
SCMand the associatedRepositoryBrowser
-
findCommitDecorator
Returns a commit decorator for the specifiedscm.- Parameters:
scm- the SCM to get the decorator forlogger- a logger to report error messages- Returns:
- a commit decorator for the specified SCM or a
CommitDecorator.NullDecoratorif the SCM is not supported or if the SCM does not provide aRepositoryBrowserimplementation
-
findCommitDecorator
Returns a commit decorator for the specifiedbuild.- Parameters:
run- the current build- Returns:
- a commit decorator for the SCM of the specified build or a
CommitDecorator.NullDecoratorif the SCM is not supported or if the SCM does not provide aRepositoryBrowserimplementation
-
findCommitDecorator
Returns a commit decorator for the specifiedbuildand 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 buildscmKey- 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.NullDecoratorif no matching SCM is found, the SCM is not supported, or the SCM does not provide aRepositoryBrowserimplementation
-