Catching InterptedException Within Builder Plugin (Java)

14 views
Skip to first unread message

Tal Yanai

unread,
Apr 10, 2021, 5:41:53 AM4/10/21
to Jenkins Developers
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.

Jonathan Mackenzie

unread,
Apr 10, 2021, 12:06:07 PM4/10/21
to jenkin...@googlegroups.com
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


--
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 jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/17bc132f-38c9-421a-bddf-f6534e4b3b0an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages