I am using Jenkins for running Selenium tests in a monitoring way. The failures are often a temporary phenomenon (timeouts etc.). I escalate projects' execution upon a failure with Naginator plugin and the next build usually passes.
Thus, I am looking for a possibility to use a failure count which would enable sending a notification only when test fails n consecutive times. Do you have any idea how can one do it?
Daniel, I believe your best bet is to script it yourself. I had a similar problem, and came up with a three-line solution on my own without any experience with Java/Groovy.
First off, you need a way to determine that a build has failed. See my problem for the solution.
Second, you need to store the number of failed builds somewhere. The file in the project workspace is the obvious location. Use this snippet as a base:
def f = new File(manager.build.getWorkspace().getRemote() + '/GroovyFailedBuildsCount.txt')
f.createNewFile()
f.write(text)
And third, you need to send an email. Off the top of my head you could mark the first failed builds as unstable, and when the limit is reached, mark the build as failed, and have the email-ext plugin to send email notifications only on failed builds.
Groovy getting started guide has been a great help for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With