Abort current build from pipeline in Jenkins

后端 未结 7 1377
时光说笑
时光说笑 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:32

    Following this documentation from Jenkins, you should be able to generate an error to stop the build and set the build result like this:

    currentBuild.result = 'ABORTED'

    Hope that helps.

提交回复
热议问题