input-Stage
This commit is contained in:
parent
2305943626
commit
3c1692a326
43
Jenkinsfile
vendored
Normal file
43
Jenkinsfile
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
@Library('jenkins-shlib')_
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Approve'){
|
||||
steps {
|
||||
script {
|
||||
def userInput
|
||||
try {
|
||||
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
|
||||
def user = err.getCauses()[0].getUser()
|
||||
userInput = false
|
||||
echo "Aborted by: [${user}]"
|
||||
}
|
||||
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}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user