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

Retry block in Jenkins workflow script is executed in a different context

    Details

    • Similar Issues:

      Description

      I set up a workflow script using a Git repository. The workflow script performs some Git actions using SSH.

          sh "git checkout develop"
      
          //Retry pushing to develop several times because it could be that a developer pushes before this finishes
          retry(5) {
              sh 'git pull --no-edit'
              sh "git push origin develop"
          }
      

      This script fails however with the error message that there is no remote branch tracked by the current branch.

      We've been using this script for a long time now on release 1.10.1 of the workflow plugin, but this issue started occurring after the upgrade to release 2.

      I downgraded to release 1.10.1 again and everything started working again.

        Attachments

          Activity

          drieselliott Dries Elliott created issue -
          drieselliott Dries Elliott made changes -
          Field Original Value New Value
          Epic Link JENKINS-31152 [ 165808 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 170214 ] JNJira + In-Review [ 183809 ]
          abayer Andrew Bayer made changes -
          Component/s pipeline-general [ 21692 ]
          abayer Andrew Bayer made changes -
          Component/s workflow-plugin [ 18820 ]
          abayer Andrew Bayer made changes -
          Labels git workflow git pipeline workflow
          abayer Andrew Bayer made changes -
          Labels git pipeline workflow git pipeline
          jglick Jesse Glick made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Incomplete [ 4 ]
          drieselliott Dries Elliott made changes -
          Resolution Incomplete [ 4 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          drieselliott Dries Elliott made changes -
          Description I set up a workflow script using a Git repository. The workflow script performs some Git actions using SSH.

              sh "git checkout develop"

              //Retry pushing to develop several times because it could be that a developer pushes before this finishes
              retry(5) {
                  sh 'git pull --no-edit'
                  sh "git push origin develop"
              }

          This script fails however with the error message that there is no remote branch tracked by the current branch.

          We've been using this script for a long time now on release 1.10.1 of the workflow plugin, but this issue started occurring after the upgrade to release 2.

          I downgraded to release 1.10.1 again and everything started working again.
          I set up a workflow script using a Git repository. The workflow script performs some Git actions using SSH.

          {code:groovy}
              sh "git checkout develop"

              //Retry pushing to develop several times because it could be that a developer pushes before this finishes
              retry(5) {
                  sh 'git pull --no-edit'
                  sh "git push origin develop"
              }
          {code}

          This script fails however with the error message that there is no remote branch tracked by the current branch.

          We've been using this script for a long time now on release 1.10.1 of the workflow plugin, but this issue started occurring after the upgrade to release 2.

          I downgraded to release 1.10.1 again and everything started working again.
          drieselliott Dries Elliott made changes -
          Description I set up a workflow script using a Git repository. The workflow script performs some Git actions using SSH.

          {code:groovy}
              sh "git checkout develop"

              //Retry pushing to develop several times because it could be that a developer pushes before this finishes
              retry(5) {
                  sh 'git pull --no-edit'
                  sh "git push origin develop"
              }
          {code}

          This script fails however with the error message that there is no remote branch tracked by the current branch.

          We've been using this script for a long time now on release 1.10.1 of the workflow plugin, but this issue started occurring after the upgrade to release 2.

          I downgraded to release 1.10.1 again and everything started working again.
          I set up a workflow script using a Git repository. The workflow script performs some Git actions using SSH.

          {code}
              sh "git checkout develop"

              //Retry pushing to develop several times because it could be that a developer pushes before this finishes
              retry(5) {
                  sh 'git pull --no-edit'
                  sh "git push origin develop"
              }
          {code}

          This script fails however with the error message that there is no remote branch tracked by the current branch.

          We've been using this script for a long time now on release 1.10.1 of the workflow plugin, but this issue started occurring after the upgrade to release 2.

          I downgraded to release 1.10.1 again and everything started working again.
          jglick Jesse Glick made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Jesse Glick [ jglick ]
          Resolution Incomplete [ 4 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              drieselliott Dries Elliott
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: