44 lines
1.0 KiB
Groovy
44 lines
1.0 KiB
Groovy
@Library('jenkins-shlib')_
|
|
|
|
pipeline {
|
|
agent any
|
|
|
|
stages {
|
|
stage('Approve'){
|
|
steps {
|
|
script {
|
|
def userInput
|
|
try {
|
|
timeout(time: 5, unit: 'SECONDS') {
|
|
userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[
|
|
$class: 'BooleanParameterDefinition',
|
|
defaultValue: true,
|
|
description: '',
|
|
name: 'Please confirm you agree with this'
|
|
]])
|
|
}
|
|
} 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'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
env.RESULT = "${currentBuild.currentResult}"
|
|
echo "FINAL RESULT: ${env.RESULT}"
|
|
}
|
|
}
|
|
}
|
|
}
|