Class GitHubNotificationContext


  • public final class GitHubNotificationContext
    extends Object
    Parameter object used in notification strategies AbstractGitHubNotificationStrategy.

    When creating a new point of notification (e.g. on build completion), populate this object with the relevant details accessible at that point. When implementing a notification strategy, be aware that some details may be absent depending on the point of notification.

    Since:
    2.3.2
    • Method Detail

      • build

        public static GitHubNotificationContext build​(@Nullable
                                                      Job<?,​?> job,
                                                      @Nullable
                                                      Run<?,​?> build,
                                                      jenkins.scm.api.SCMSource source,
                                                      jenkins.scm.api.SCMHead head)
      • getJob

        public Job<?,​?> getJob()
        Returns the job, if any, associated with the planned notification event
        Returns:
        Job
        Since:
        2.3.2
      • getBuild

        public Run<?,​?> getBuild()
        Returns the run, if any, associated with the planned notification event
        Returns:
        Run
        Since:
        2.3.2
      • getSource

        public jenkins.scm.api.SCMSource getSource()
        Returns the SCMSource associated with the planned notification event
        Returns:
        SCMSource
        Since:
        2.3.2
      • getHead

        public jenkins.scm.api.SCMHead getHead()
        Returns the SCMHead associated with the planned notification event
        Returns:
        SCMHead
        Since:
        2.3.2
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getDefaultContext

        public String getDefaultContext​(TaskListener listener)
        Retrieves default context
        Parameters:
        listener - Listener for the build, if any
        Returns:
        Default notification context
        Since:
        2.3.2
      • getDefaultUrl

        public String getDefaultUrl​(TaskListener listener)
        Retrieves default URL
        Parameters:
        listener - Listener for the build, if any
        Returns:
        Default notification URL backref
        Since:
        2.3.2
      • getDefaultMessage

        public String getDefaultMessage​(TaskListener listener)
        Retrieves default notification message
        Parameters:
        listener - Listener for the build, if any
        Returns:
        Default notification message
        Since:
        2.3.2
      • getDefaultState

        public org.kohsuke.github.GHCommitState getDefaultState​(TaskListener listener)
        Retrieves default notification state
        Parameters:
        listener - Listener for the build, if any
        Returns:
        Default notification state
        Since:
        2.3.2
      • getDefaultIgnoreError

        public boolean getDefaultIgnoreError​(TaskListener listener)
        Retrieves whether plugin should ignore errors when updating the GitHub status
        Parameters:
        listener - Listener for the build, if any
        Returns:
        Default ignore errors policy
        Since:
        2.3.2