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.
  • Constructor Details

    • ChecksPublisherFactory

      public ChecksPublisherFactory()
  • Method Details

    • createPublisher

      protected Optional<ChecksPublisher> createPublisher(Run<?,?> run, TaskListener listener)
      Creates a ChecksPublisher according to the SCM used by the Run.

      If you don't want to create publisher for the run, return Optional.empty().

      Parameters:
      run - a Jenkins run
      listener - a listener to the builds
      Returns:
      the created ChecksPublisher
    • createPublisher

      protected Optional<ChecksPublisher> createPublisher(Job<?,?> job, TaskListener listener)
      Creates a ChecksPublisher according to the SCM used by the Job.

      By default,it will return Optional.empty() thus lead to a ChecksPublisher.NullChecksPublisher.

      This method will be useful if you want create publisher for Queue.Item since you can cast the belonged Queue.Task to Job.

      Parameters:
      job - a Jenkins job
      listener - 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 run
      listener - 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 job
      listener - a listener for the builds
      Returns:
      a publisher suitable for the job