exception handling take 4
This commit is contained in:
parent
9941894a4f
commit
74d6924cf6
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -8,8 +8,9 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def userInput
|
def userInput
|
||||||
|
catchError(buildResult: 'SUCCESS', stageResult: 'ABORTED') {
|
||||||
try {
|
try {
|
||||||
timeout(time: 5, unit: 'SECONDS') {
|
timeout(time: 15, unit: 'SECONDS') {
|
||||||
userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[
|
userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[
|
||||||
$class: 'BooleanParameterDefinition',
|
$class: 'BooleanParameterDefinition',
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
@ -17,11 +18,12 @@ pipeline {
|
|||||||
name: 'Please confirm you agree with this'
|
name: 'Please confirm you agree with this'
|
||||||
]])
|
]])
|
||||||
}
|
}
|
||||||
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedExceptionedException e) {
|
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
|
||||||
echo "This job timed out"
|
error "Caught ${e.toString()}"
|
||||||
} catch(err) { // input false
|
} catch(err) { // input false
|
||||||
echo "This job has been aborted"
|
echo "This job has been aborted"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (userInput == true) {
|
if (userInput == true) {
|
||||||
// do something
|
// do something
|
||||||
echo "this was successful"
|
echo "this was successful"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user