Search code examples
jenkinstimeoutjenkins-pipeline

Retry after timeout in Jenkins pipeline - workarounds


It's a known Jenkins issue that pipeline retry operation doesn't retry when there is a timeout inside of it.

Surely there are some workarounds to force retry (or substitute) to work after a timeout occurs?

Sample code where retry is not triggered:

retry(3) {
  timeout(time: 5, unit: 'MINUTES') {
    // Something that can fail
  }
}

Unless caught, the timeout error (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) causes the entire job to abort.


Solution

  • JENKINS-51454 has been fixed in jenkinsci/workflow-basic-steps-plugin#144 and released in 2.24 (Changelog).