Package io.jenkins.plugins.checks.api
Class ChecksPublisherFactory
- java.lang.Object
-
- io.jenkins.plugins.checks.api.ChecksPublisherFactory
-
- All Implemented Interfaces:
ExtensionPoint
public abstract class ChecksPublisherFactory extends Object implements ExtensionPoint
A publisher API for consumers to publish checks.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description ChecksPublisherFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<ChecksPublisher>
createPublisher(Job<?,?> job, TaskListener listener)
protected Optional<ChecksPublisher>
createPublisher(Run<?,?> run, TaskListener listener)
static ChecksPublisher
fromJob(Job<?,?> job, TaskListener listener)
Returns a suitable publisher for the job.static ChecksPublisher
fromRun(Run<?,?> run, TaskListener listener)
Returns a suitable publisher for the run.
-
-
-
Method Detail
-
createPublisher
protected Optional<ChecksPublisher> createPublisher(Run<?,?> run, TaskListener listener)
Creates aChecksPublisher
according to theSCM
used by theRun
.If you don't want to create publisher for the run, return
Optional.empty()
.- Parameters:
run
- a Jenkins runlistener
- a listener to the builds- Returns:
- the created
ChecksPublisher
-
createPublisher
protected Optional<ChecksPublisher> createPublisher(Job<?,?> job, TaskListener listener)
Creates aChecksPublisher
according to theSCM
used by theJob
.By default,it will return
Optional.empty()
thus lead to aChecksPublisher.NullChecksPublisher
.This method will be useful if you want create publisher for
Queue.Item
since you can cast the belongedQueue.Task
toJob
.- Parameters:
job
- a Jenkins joblistener
- a listener to the builds- Returns:
- the created
ChecksPublisher
-
fromRun
public static ChecksPublisher fromRun(Run<?,?> run, TaskListener listener)
Returns a suitable publisher for the run.- Parameters:
run
- a Jenkins runlistener
- a listener for the builds- Returns:
- a publisher suitable for the job
-
fromJob
public static ChecksPublisher fromJob(Job<?,?> job, TaskListener listener)
Returns a suitable publisher for the job.- Parameters:
job
- a Jenkins joblistener
- a listener for the builds- Returns:
- a publisher suitable for the job
-
-