Detect Jenkins build abort event

限于喜欢 提交于 2019-12-11 03:35:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!