Read about how Jenkins aborts a build here
https://www.jenkins.io/doc/book/using/aborting-a-build/
It is somewhat OS dependent. I was looking for the same thing on a windows
10 agent but TerminateProcess is a non-interruptible function.
I heard that some folks had tried in-memory patching on the fly, sounds a
bit dicey.
A watchdog or dead man's handle type of approach might be more robust.
If Jenkins had an abort hook built in to ensure equipment is returned to a
safe state but once you put the hook in, it is also open to misuse.
If Jenkins had a 'build other job on abort' type of thing that design
introduces all sorts of potential race conditions and cascading errors.
Don't know about your use case but I settled on putting the 'return to safe
state' function into the equipment under test and triggered by an over
boundary condition. Which is where it should have been in the first place.
I can't think of a way to do this without making Jenkins less robust, and I
love the robustness of Jenkins.
Would like to hear if others have the same type of requirement for an
action when a Jenkins job is aborted.
Jonathan


On Sat, Apr 10, 2021 at 2:41 AM Tal Yanai <[email protected]> wrote:

> Hi,
>
> Is there any way to catch an InterptedException within the Builder Perform
> method?
>
> I'm trying to catch the event of aborting a build.
>
> Thanks,
>
> Tal.
>
> --
> 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/17bc132f-38c9-421a-bddf-f6534e4b3b0an%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/17bc132f-38c9-421a-bddf-f6534e4b3b0an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAO1vCWFRBxX6-zpowfA8CADZnpf-0aCA6_uH5-fdzyx0X69FMA%40mail.gmail.com.

Reply via email to