Class EmailTrigger

java.lang.Object
hudson.plugins.emailext.plugins.EmailTrigger
All Implemented Interfaces:
ExtensionPoint, Describable<EmailTrigger>
Direct Known Subclasses:
AbortedTrigger, AbstractScriptTrigger, AlwaysTrigger, BuildingTrigger, FailureTrigger, FirstUnstableTrigger, FixedTrigger, FixedUnhealthyTrigger, ImprovementTrigger, NotBuiltTrigger, NthFailureTrigger, PreBuildTrigger, RegressionTrigger, StatusChangedTrigger, StillFailingTrigger, StillUnstableTrigger, SuccessTrigger, UnstableTrigger

public abstract class EmailTrigger extends Object implements Describable<EmailTrigger>, ExtensionPoint
  • Constructor Details

    • EmailTrigger

      @Deprecated protected EmailTrigger(boolean sendToList, boolean sendToDevs, boolean sendToRequestor, boolean sendToCulprits, String recipientList, String replyTo, String subject, String body, String attachmentsPattern, int attachBuildLog, String contentType)
      Deprecated.
    • EmailTrigger

      protected EmailTrigger(List<RecipientProvider> recipientProviders, String recipientList, String replyTo, String subject, String body, String attachmentsPattern, int attachBuildLog, String contentType)
    • EmailTrigger

      protected EmailTrigger(net.sf.json.JSONObject formData)
  • Method Details

    • all

    • allWatchable

      public static List<EmailTriggerDescriptor> allWatchable()
    • trigger

      public abstract boolean trigger(AbstractBuild<?,?> build, TaskListener listener)
      Implementors of this method need to return true if the conditions to trigger an email have been met.
      Parameters:
      build - The Build object after the project has been built
      listener - Used for logging to the build log
      Returns:
      true if the conditions have been met to trigger a build of this type
    • getEmail

      public EmailType getEmail()
      Get the email that is with this trigger.
      Returns:
      the email
    • setEmail

      public void setEmail(EmailType email)
    • getDescriptor

      public EmailTriggerDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface Describable<EmailTrigger>
    • configure

      public boolean configure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData)
    • createMailType

      @Deprecated protected EmailType createMailType(net.sf.json.JSONObject formData)
      Deprecated.
    • createMailType

      protected EmailType createMailType(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData)
    • getNumFailures

      protected int getNumFailures(Run<?,?> build)
      Determine the number of direct failures in the given build. If it aggregates downstream results, ignore contributed failures. This is because at the time this trigger runs, the current build's aggregated results aren't available yet, but those of the previous build may be.
      Parameters:
      build - The project run to get the number of test failures for.
      Returns:
      The number of test failures for the Run
    • isPreBuild

      public boolean isPreBuild()
      Should this trigger run before the build? Defaults to false.
      Returns:
      true if the trigger should be checked before the build.
    • shouldBypassThrottling

      public boolean shouldBypassThrottling()
      Should this trigger bypass the email throttling? Defaults to false. Critical triggers like build failures override this to true.
      Returns:
      true if the trigger should bypass the email throttling.