I've a Jenkins pipeline with following stage -
stage('Test') {
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
script {
//some code here
}
}
}
Here I've set timeout but there will be one parameter say `TimeoutEnabled`. If it has value `true`, only then use timeout restrictions otherwise there will be no timeout restriction for the stage.
How can I handle this efficiently without having duplicated code?