Package io.jenkins.plugins.checks.api
Class ChecksPublisherFactory
java.lang.Object
io.jenkins.plugins.checks.api.ChecksPublisherFactory
- All Implemented Interfaces:
ExtensionPoint
A publisher API for consumers to publish checks.
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.
-
Constructor Details
-
ChecksPublisherFactory
public ChecksPublisherFactory()
-
-
Method Details
-
createPublisher
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
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
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
Returns a suitable publisher for the job.- Parameters:
job
- a Jenkins joblistener
- a listener for the builds- Returns:
- a publisher suitable for the job
-