Abort current build from pipeline in Jenkins

You can mark the build as ABORTED, and then use the error step to cause the build to stop:

if (!continueBuild) {
    currentBuild.result="ABORTED"
    error('Stopping early…')
}

In the Stage View, this will show that the build stopped at this stage, but the build overall will be marked as aborted, rather than failed (see the grey icon for build #9):

Pipeline Stage View

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)