// Declarative // pipeline { agent any stages { stage('Deploy') { when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS'  ① } } steps { sh 'make publish' } } } } // Script // node { /* .. snip .. */ stage('Deploy') { if (currentBuild.result == null || currentBuild.result == 'SUCCESS') {  ① sh 'make publish' } } /* .. snip .. */ } ① Accessing the  currentBuild.result  variable allows the Pipeline to determine if there were any test failures. In which case, the value would be  UNSTABLE . Assuming everything has executed successfully in the example Jenkins Pipeline, each successful Pipeline run will have associated build artifacts archived, test results reported upon and the full console output all in Jenkins. A Scripted Pipeline can include conditional tests (shown above), loops, try/catch/finally blocks and even functions. The next section will cover this advanced Scripted Pipeline syntax in more detail. 34