I'm constructing a declarative Jenkins pipeline where i want to have timeout of a stage in a way that subsequent stage continue to run gracefully. I'm sure there are no inter-dependencies between stages in this usecase.
pipeline {
agent any
stages {
stage('Build-1') {
options {
timeout(time: 1, unit: 'HOURS')
}
steps {
echo 'Hello World 1'
}
}
stage('Build-2') {
steps {
echo 'Hello World 2'
}
}
}
}
In the above example, after timeout of stage Build-1 the pipeline aborts with following message:
Sending interrupt signal to process
Cancelling nested steps due to timeout
Here, stage Build-2 is not executed. Is there a way where despite the timeout in stage Build-1, pipeline can continue to run stage Build-2 gracefully.
I'm referring to following documentation: https://jenkins.io/doc/book/pipeline/syntax/#options