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

retry in Declarative options is ignored

    XMLWordPrintable

Details

    Description

      A pipeline like this will never actually retry - it'll just run once and fail.

      pipeline {
        agent any
        options {
          retry (3)
        }
        stages {
          stage("foo") {
            steps {
              echo "hello"
              error "Failing - retry me!"
            }
          }
        }
      }
      

      This is because the error thrown in the stage is caught and not rethrown again until the end of the build, bypassing the retry step's execution completely.

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/164
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #164 (Web Link)" [ 17200 ]

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/OptionsTest.java
            pipeline-model-definition/src/test/resources/retryOptions.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/a826a300e47c2c45856f5224300ba3bfb7062caa
            Log:
            [FIXED JENKINS-45270] Properly throw errors so wrappers can catch them.

            Specifically this will make retry from the options directive actually work.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/OptionsTest.java pipeline-model-definition/src/test/resources/retryOptions.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/a826a300e47c2c45856f5224300ba3bfb7062caa Log: [FIXED JENKINS-45270] Properly throw errors so wrappers can catch them. Specifically this will make retry from the options directive actually work.
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "CloudBees Internal OSS-2371 (Web Link)" [ 18331 ]
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.
            bitwiseman Liam Newman made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

              abayer Andrew Bayer
              abayer Andrew Bayer
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: