问题
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
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/32065516/detect-jenkins-build-abort-event