Abort current build from pipeline in Jenkins

后端 未结 7 1388
时光说笑
时光说笑 2020-12-02 13:06

I have a Jenkins pipeline which has multiple stages, for example:

node(\"nodename\") {
  stage(\"Checkout\") {
    git ....
  }
  stage(\"Check Preconditions         


        
7条回答
  •  广开言路
    2020-12-02 13:37

    The thing that we use is:

    try {
     input 'Do you want to abort?'
    } catch (Exception err) {
     currentBuild.result = 'ABORTED';
     return;
    }
    

    The "return" at the end makes sure that no further code is executed.

提交回复
热议问题