-
Bug
-
Resolution: Fixed
-
Minor
-
jenkins: jenkins:2.123-alpine (running in docker)
Pipeline: Declarative: 1.2.9
Pipeline: Groovy: 2.53
When a timeout call is fired inside of a retry, retry is not being triggered and job execution is aborted, the only way to make it work is by surrounding the timeout operation with a try/catch.
without try/catch
Log output
Cancelling nested steps due to timeout
Execution result
Timeout has been exceeded Finished: ABORTED
with try/catch
Log output
Timeout set to expire after 2 sec without activity
Sleeping for 2 sec
Cancelling nested steps due to timeout
ERROR: catched timeout! org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
Retrying
Execution result
Finished: SUCCESS
Examples to reproduce the issue
Failing example
node { def timeoutSeconds = 3 stage('Preparation') { // for display purposes retry(3){ timeout(activity: true, time: 2, unit: 'SECONDS') { sleep(timeoutSeconds) } timeoutSeconds-- } } }
Working example
node { def timeoutSeconds = 3 stage('Preparation') { // for display purposes retry(3){ try{ timeout(activity: true, time: 2, unit: 'SECONDS') { sleep(timeoutSeconds) } }catch(err){ timeoutSeconds-- script{ def user = err.getCauses()[0].getUser() error "[${user}] catched timeout! $err" } } } } }
- relates to
-
JENKINS-51928 Timeout is caught by the most internal try-catch, but should be caught by the try-catch that surrounds the timeout step
- Resolved
-
JENKINS-60354 Updated pipeline build step does not work with retry, catchError, or warnError
- Resolved
- links to