2
votes

Is it possible to detect Jenkins build abort event in Builder plugin and perform graceful process finalization?

This is the only information I was able to find: https://wiki.jenkins-ci.org/display/JENKINS/Aborting+a+build

2

2 Answers

4
votes

InterruptedException is thrown on job abort, so by catching it, it is possible to detect and handle job termination.

More detailed information can be found here.

0
votes

You can use Post-build task plugin:-

https://wiki.jenkins-ci.org/display/JENKINS/Post+build+task

Use this plugin to grep when is the build aborted. Add the search message and then run your clean-up script (shell script also works here.)

For more info about aborting build in Jenkins ,click here

Also this might be useful