You can detect if the build has been aborted by accessing Thread.interrupted() 
or Thread.currentThread().isInterrupted();
But your long running task needs to check this...

> Am 19.03.2018 um 16:54 schrieb Marcin Zajączkowski <[email protected]>:
> 
> Hi,
> 
> In the Groovy Postbuild plugin I call an external service in a loop waiting 
> for some other operation to finish. It works, however, the build ignores a 
> try to abort it using the Jenkins UI or an API.
> 
> I tried to check if the current thread isn't interupted 
> (Thread.currentThread().isInterrupted()), but it's not. The build results 
> (manager.getResult()) is also SUCCESS.
> 
> How can I programatically detect (probably using some Jenkins API) that it 
> was requested to abort a build to break my loop and allow the build to be 
> aborted?
> 
> Marcin
> 
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-dev/974664bf-1e64-411c-9e19-19a64304b86b%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-dev/974664bf-1e64-411c-9e19-19a64304b86b%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/4D802082-CE51-4C14-927A-2C54CDC8540E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to