@Library('jenkins-shlib')_ pipeline { agent any environment { PROD_TAG = '11_abcdef9' deployment_name = 'some_random_deployment' } stages { stage('Approve'){ steps { script { def userInput try { timeout(time: 15, unit: 'SECONDS') { userInput = input( id: 'approve_deploy_at_prod', ok: 'Yepp, go on!', message: "Do you want to deploy version ${PROD_TAG}@${env.deployment_name} in PROD?"/*, parameters: [ [ $class: 'BooleanParameterDefinition', defaultValue: true, description: '', name: 'Please confirm you agree with this' ] ]*/ ) } } catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { error "Caught ${e.toString()}" } catch(err) { // input false echo "This job has been aborted" } if (userInput == true) { // do something echo "this was successful" } else { // do something else echo "this was not successful" currentBuild.result = 'FAILURE' } } } } stage('deploy@PROD'){ steps{ script{ echo "deploy@PROD..." } } } } post { always { script { env.RESULT = "${currentBuild.currentResult}" echo "FINAL RESULT: ${env.RESULT}" } } } }