When a build is aborted, either manually or by a timeout, then I want 
to change the status of the build to 'Failed'. 

I'm using the following code, in the Groovy post build plugin, to change an 
aborted build to a failed build:

    if ( hudson.model.Result.ABORTED == manager.build.result )
    {
        manager.buildFailure()
        manager.addBadge("yellow.gif", "Aborted")
    }

The code is definatley being hit as the yellow gif appears to the right of 
the 
build name.

This is the log output:


        Building on master in workspace 
/var/lib/jenkins/jobs/Test-Trunk-Build/workspace
        No emails were triggered.
        [workspace] $ /bin/bash /tmp/hudson5114040264291748307.sh
        Build timed out (after 3 minutes). Marking the build as aborted.
        Build was aborted
        ...  
        Build step 'Groovy Postbuild' marked build as failure
        ...
        Email was triggered for: Aborted
        Sending email for trigger: Aborted
        Sending email to: ....
        Finished: ABORTED

As you can see the build status is 'ABORTED' and the notification email 
states the same.

There is a 'Likely stuck' option on the timeout plugin which will mark the 
build 
as failed if the progress bar is red but, I need to set an absolute time on 
the timeout
for a build.

Reply via email to