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

Updated pipeline build step does not work with retry, catchError, or warnError

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      workflow-basic-steps 2.19, pipeline-build-step 2.11, workflow-step-api 2.22

      Description

      We just upgraded pipeline-build-step from 2.9 to 2.10. The following no longer retries:

      pipeline {
          agent any
      
          stages {
              stage('bug') {
                  steps {
                      retry(3) {
                          echo 'in the retry loop'
                          //throw new Exception('failing in retry loop') // This runs (when uncommented) several times before the pipeline exits with failure.
                          build(job: 'some/job/that/fails', propagate: true) // This only runs once before the pipeline exits with failure.
                      }
                  }
              }
          }
      }
      

      When the sub-build fails, the retry loop exits immediately and does not retry. This didn't used to happen. When raising an error in another way (e.g. the `throw new Exception`, commented out, in the code above), `retry` works as expected.

      A workaround is to try/catch the `build()` call and, in catch, `throw new Exception(...)`. If the caught exception is directly re-thrown, we see the same behavior where `retry` does not loop.

        Attachments

          Issue Links

            Activity

            jonathanb1 Jonathan B created issue -
            jonathanb1 Jonathan B made changes -
            Field Original Value New Value
            Description We just upgraded pipeline-build-step from 2.9 to 2.10. The following no longer retries:

            {code}
            pipeline {
                agent any

                stages {
                    stage('bug') {
                        steps {
                            retry(3) {
                                echo 'in the retry loop'
                                //throw new Exception('failing in retry loop') // This runs (when uncommented) several times before the pipeline exits with failure.
                                build(job: 'some/job/that/fails', propagate: true) // This only runs once before the pipeline exits with failure.
                            }
                        }
                    }
                }
            }
            {code}

            When the sub-build fails, the retry loop exits immediately and does not retry. This didn't used to happen. When raising an error in another way (e.g. the `throw new Exception`, commented out, in the code above), `retry` works as expected.
            We just upgraded pipeline-build-step from 2.9 to 2.10. The following no longer retries:

            {code}
            pipeline {
                agent any

                stages {
                    stage('bug') {
                        steps {
                            retry(3) {
                                echo 'in the retry loop'
                                //throw new Exception('failing in retry loop') // This runs (when uncommented) several times before the pipeline exits with failure.
                                build(job: 'some/job/that/fails', propagate: true) // This only runs once before the pipeline exits with failure.
                            }
                        }
                    }
                }
            }
            {code}

            When the sub-build fails, the retry loop exits immediately and does not retry. This didn't used to happen. When raising an error in another way (e.g. the `throw new Exception`, commented out, in the code above), `retry` works as expected.

            A workaround is to try/catch the `build()` call and, in catch, `throw new Exception(...)`. If the caught exception is directly re-thrown, we see the same behavior where `retry` does not loop.
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-49073 [ JENKINS-49073 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-44379 [ JENKINS-44379 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-49073 [ JENKINS-49073 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-44379 [ JENKINS-44379 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-49073 [ JENKINS-49073 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue is caused by JENKINS-44379 [ JENKINS-44379 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "Discussion of potential fixes (Web Link)" [ 24103 ]
            dnusbaum Devin Nusbaum made changes -
            Summary Updated pipeline build step does not work with retry Updated pipeline build step does not work with retry, catchError, or warnError
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-step-api-plugin#51 (Web Link)" [ 24116 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/pipeline-build-step-plugin#39 (Web Link)" [ 24117 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-basic-steps-plugin#102 (Web Link)" [ 24118 ]
            dnusbaum Devin Nusbaum made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            dnusbaum Devin Nusbaum made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            dnusbaum Devin Nusbaum made changes -
            Assignee Devin Nusbaum [ dnusbaum ]
            dnusbaum Devin Nusbaum made changes -
            Released As workflow-basic-steps 2.19, pipeline-build-step 2.11, workflow-step-api 2.22
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            basil Basil Crow made changes -
            Link This issue relates to JENKINS-51454 [ JENKINS-51454 ]

              People

              Assignee:
              dnusbaum Devin Nusbaum
              Reporter:
              jonathanb1 Jonathan B
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: