Hi,

I am implementing a custom "*wait loop"* to wait for triggered jobs in
groovy. I am using the Groovy plugin and executing either as a Groovy
system script or as a post build action.

I have it all figured out but now I would like the wait loop to detect an
abort request from the UI (Hitting the little red X). This executes doStop
on the AbstractBuild (I am running a FreeStyleBuild) but in this case does
not seem to do anything. I suspect that it is because of the executor being
"null".

Can I perhaps register a listener or in some other way get a notification
(or polling some var) to detect that an abort was requested?

doStop from
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractBuild.java


    @RequirePOST
    public synchronized HttpResponse doStop() throws IOException,
ServletException {
        Executor e = getExecutor();
        if (e==null)
            e = getOneOffExecutor();
        if (e!=null)
            return e.doStop();
        else
            // nothing is building
            return HttpResponses.forwardToPreviousPage();
    }

Thanks!
//Fredrik



On 8 May 2014 13:16, Fredrik Andersson <fredrik....@gmail.com> wrote:

> Hi,
>
> I am implementing a custom "*wait loop"* to wait for triggered jobs in
> groovy. I am using the Groovy plugin and executing either as a Groovy
> system script or as a post build action.
>
> I have it all figured out but now I would like the wait loop to detect an
> abort request from the UI (Hitting the little red X). This executes doStop
> on the AbstractBuild (I am running a FreeStyleBuild) but in this case does
> not seem to do anything. I suspect that it is because of the executor being
> "null".
>
> Can I perhaps register a listener or in some other way get a notification
> (or polling some var) to detect that an abort was requested?
>
> doStop from
> https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractBuild.java
>
>
>     @RequirePOST
>     public synchronized HttpResponse doStop() throws IOException, 
> ServletException {
>         Executor e = getExecutor();
>         if (e==null)
>             e = getOneOffExecutor();
>         if (e!=null)
>             return e.doStop();
>         else
>             // nothing is building
>             return HttpResponses.forwardToPreviousPage();
>     }
>
> Thanks!
>
> //Fredrik
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to