playground-jenkins/Jenkinsfile
2020-07-12 22:46:13 +02:00

67 lines
1.7 KiB
Groovy

@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') {
emailext(
to: 'devel@zwackl.de',
subject: "[${env.JOB_NAME}] is waiting for your decision",
body: "KLICK HERE: ${env.BUILD_URL}input/"
)
userInput = input(
message: "Do you want to deploy version ${PROD_TAG}@${env.deployment_name} in PROD?",
ok: 'Yepp, go on!'/*,
parameters: [
[
$class: 'BooleanParameterDefinition',
defaultValue: true,
description: '',
name: 'Please confirm you agree with this'
]
]*/
)
}
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
error "${e.toString()}: this job was either aborted or timed out."
}
/*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}"
}
}
}
}