import hudson.plugins.accurev.* def build_ok = true pipeline { agent any stages { stage('1') { steps { sh 'exit 0' } } stage('2') { steps { script { try { sh 'exit 0' } finally { echo "... finished" } } } } stage('3') { when { expression { return build_ok; } } steps { sh 'exit 0' } } } }