如果要在异常情况下中止程序,则可以使用管道步骤
error以错误停止管道执行。范例:
try { // Some pipeline pre} catch(Exception e) { // Do something with the exception error "Program failed, please read logs..."}
如果要以成功状态停止管道,则可能需要使用某种布尔值来指示必须停止管道,例如:
boolean continuePipeline = truetry { // Some pipeline pre} catch(Exception e) { // Do something with the exception continuePipeline = false currentBuild.result = 'SUCCESS'}if(continuePipeline) { // The normal end of your pipeline if exception is not caught. }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)