简体   繁体   中英

Jenkins email-ext plugin add a trigger for a specific build failure

I have email-ext plugin configured on Jenkins. Currently I'm sending mails using following triggers.

  • Failure-1st
  • Failure-2nd
  • Failure-Still
  • Success

What I need to know, is there a way to add a custom trigger to send mails on a specific build failure

assume that I need to send a mail on build Failure-4th

You can use Trigger Scripts in groovy to define before or after the build if the email must be send or not. There are four objects added to the model for the script to use to interact with the build.

  • build: This is the current build, usually a child class of AbstractBuild
  • project: The project object that the current build was started from, usually a child class of AbstractProject
  • rooturl: The Jenkins instance root URL, useful for links.
  • out: A PrintStream that can be used to log messages to the build log.

The last line in the script should resolve to a boolean true or false .

So I guess you can do what you want if you use a Groovy Script. For more info check: e-mail ext

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM