Running a Post Build script when a Jenkins job is aborted

后端 未结 4 1753
执笔经年
执笔经年 2021-02-07 02:23

Is there a possible way / plugin that can run a post build script when a Jenkins job is aborted. I do see that the post build plugin provides an action to execute a set of scrip

4条回答
  •  情深已故
    2021-02-07 02:36

    If you use a scripted pipeline, you can always use a try/catch/finally set, where the build gets executed in the try block and the postbuild steps are in the finally block. This way, even if the build fails, post build steps are executed.

    try {
            build here
    }catch(FlowInterruptedException interruptEx){
    
        catch exception here
    } finally {
    
        postBuild(parameters)
    
    }
    

提交回复
热议问题