@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: 300, unit: 'SECONDS') { // https://stackoverflow.com/questions/52093926/jenkins-pipeline-send-email-at-user-input // https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#mail-mail // Oder: http://{{jenkins_uri}}/blue/organizations/jenkins/${env.JOB_NAME - ohne /Branch}/detail/${env.BRANCH_NAME}/${env.BUILD_ID}/pipeline/${env.BUILD_ID} emailext to: 'devel@zwackl.de', subject: "[${env.JOB_NAME}] is waiting for your decision", body: "${env.BUILD_URL}" 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) { // input timed out error "Caught ${e.toString()}" } catch(err) { // manually aborted 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}" } } } }