我想抓住jenkins的工作中止事件,这可能吗?
您应该使用currentBuild.currentResult变量来捕获中止状态。
currentBuild.currentResult
if (currentBuild.currentResult == 'ABORTED') { // Do your stuff here }
只需将其放在脚本的末尾,或者放在finally的try/catch/finally块中。
finally
try/catch/finally