Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41276

Abort doesn't work with Retry

    XMLWordPrintable

Details

    Description

      When using a retry wrapper in Pipeline you cannot abort during the retry, the abort is treated as any other failiure.

      Attachments

        1. console
          1 kB
        2. Jenkinsfile
          0.2 kB

        Issue Links

          Activity

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/steps/RetryStepExecution.java
            src/test/java/org/jenkinsci/plugins/workflow/steps/RetryStepTest.java
            http://jenkins-ci.org/commit/workflow-basic-steps-plugin/422295a5dbac5192e0320d916fb37838e3c24c87
            Log:
            [FIXED JENKINS-41276] Do not continue to retry when the failure is a user interruption.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/RetryStepExecution.java src/test/java/org/jenkinsci/plugins/workflow/steps/RetryStepTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/422295a5dbac5192e0320d916fb37838e3c24c87 Log: [FIXED JENKINS-41276] Do not continue to retry when the failure is a user interruption.
            jglick Jesse Glick added a comment -

            Possibly should be extended to handle aborts coming from timeout, or perhaps any cause.

            jglick Jesse Glick added a comment - Possibly should be extended to handle aborts coming from timeout , or perhaps any cause.

            Still now working.
            Pipeline: Basic Steps 2.6
            sample: Jenkinsfileoutput: console

            bkmeneguello Bruno Meneguello added a comment - Still now working. Pipeline: Basic Steps 2.6 sample:  Jenkinsfile output:  console
            timja Tim Jacomb added a comment - - edited

            I'm also having the same issue as Bruno...

            Apologies my issue looks different I'm catching the exception which interferes

            timja Tim Jacomb added a comment - - edited I'm also having the same issue as Bruno... Apologies my issue looks different I'm catching the exception which interferes
            b_dean Ben Dean added a comment -

            Just ran into this and I imagine my scenario is similar to what bkmeneguello and timja were getting.

            If you have an exception thrown in a finally block it'll win out instead of the FlowInterruptedException

            retry(5) {
                try {
                    sh "do_something_slow"
                } finally {
                    echo "Cleaning up"
            
                    // Do something that raises an exception
                    def x = 1/0
                }
            }
            

            You'll end up losing the abort exception and retrying again even though you aborted. Same thing with timeouts.

            b_dean Ben Dean added a comment - Just ran into this and I imagine my scenario is similar to what  bkmeneguello and timja were getting. If you have an exception thrown in a finally block it'll win out instead of the FlowInterruptedException retry(5) { try { sh "do_something_slow" } finally { echo "Cleaning up" // Do something that raises an exception def x = 1/0 } } You'll end up losing the abort exception and retrying again even though you aborted. Same thing with timeouts.

            People

              jglick Jesse Glick
              hrmpw Patrick Wolf
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: