I have the following in my Jenkinsfile:
pipeline {
agent none
environment {
timeout_mins = 1
}
options {
timeout(time: "$
As @burnettk says it’s a limitation with the options block. It's not the most elegant but you can use timeout as a step e.g.
pipeline {
agent none
environment {
timeout_mins = 1
}
stages {
stage("test print") {
steps {
timeout(time: env.timeout_mins.toInteger(), unit: 'MINUTES') {
echo "timeout_mins: ${env.timeout_mins}"
sh "sleep 120"
}
}
}
}
}