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/job/WorkflowRun.java
            src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/0eeee8d0d482f08149530a337a5500b760abd9dc
            Log:
            JENKINS-41276 Make sure a FlowInterruptedException coming from a build abort is properly initialized with causes.

            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/job/WorkflowRun.java src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java http://jenkins-ci.org/commit/workflow-job-plugin/0eeee8d0d482f08149530a337a5500b760abd9dc Log: JENKINS-41276 Make sure a FlowInterruptedException coming from a build abort is properly initialized with causes.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/00d7e14f4613fa45d2280c246808ee477b74515e
            Log:
            JENKINS-41276 Merging #36 incl. workflow-step-api 2.9

            Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/139ac7e5da1e...00d7e14f4613

            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/job/WorkflowRun.java src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java http://jenkins-ci.org/commit/workflow-job-plugin/00d7e14f4613fa45d2280c246808ee477b74515e Log: JENKINS-41276 Merging #36 incl. workflow-step-api 2.9 Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/139ac7e5da1e...00d7e14f4613

            Code changed in jenkins
            User: rsandell
            Path:
            .gitignore
            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/fe87fea108a8d3f8608f15c2253090a0099cd1d4
            Log:
            JENKINS-41276 Do not retry if user aborted the build

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: rsandell Path: .gitignore 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/fe87fea108a8d3f8608f15c2253090a0099cd1d4 Log: JENKINS-41276 Do not retry if user aborted the build

            Code changed in jenkins
            User: rsandell
            Path:
            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/3c2bba96d5ac14eb47dbbd326a6739f023e5003e
            Log:
            JENKINS-41276 Fixed some review comments

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: rsandell Path: 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/3c2bba96d5ac14eb47dbbd326a6739f023e5003e Log: JENKINS-41276 Fixed some review comments

            Code changed in jenkins
            User: rsandell
            Path:
            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/3c9dfec7b287d6f8b6b17febf9d069e9571b7468
            Log:
            JENKINS-41276 Reverting back to check the InterruptedBuilAction

            Because the FlowInterruptedAction didn't contain any causes.
            Added an extra check in the test to make sure the build is actually
            aborted and doesn't continue to run after the retry.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: rsandell Path: 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/3c9dfec7b287d6f8b6b17febf9d069e9571b7468 Log: JENKINS-41276 Reverting back to check the InterruptedBuilAction Because the FlowInterruptedAction didn't contain any causes. Added an extra check in the test to make sure the build is actually aborted and doesn't continue to run after the retry.

            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: