Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fail hudson build with groovy script

I have a couple of post build actions that I run on my Hudson build. They are currently bash scripts, and if I want to fail the biuld from them, I just return a non-zero value. Is there a way to fail the build from another scripting language (such as groovy)? Do I just write a script that also returns non-zero? Or is there a particular plugin I need to enable this?

thanks, Jeff

like image 309
Jeff Storey Avatar asked Dec 02 '10 14:12

Jeff Storey


2 Answers

A way to do this programmatically within the Groovy script is:

throw new hudson.AbortException("Something was in my eye...")
like image 194
Patrice M. Avatar answered Oct 24 '22 01:10

Patrice M.


The Groovy Postbuild Plugin seems to be what you need, and has a method called buildFailure() which sets the build result to FAILURE.

like image 44
tim_yates Avatar answered Oct 24 '22 01:10

tim_yates