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
          Hide
          jglick Jesse Glick added a comment -

          Probably some mistake in Git usage. No steps to reproduce from scratch given, so cannot be sure.

          Show
          jglick Jesse Glick added a comment - Probably some mistake in Git usage. No steps to reproduce from scratch given, so cannot be sure.
          jglick Jesse Glick made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Incomplete [ 4 ]
          Hide
          drieselliott Dries Elliott added a comment -

          I find it a bit astonishing that after four months someone finally looks at this issue and the first reaction is to just close it.

          I believe in my original description I provided all the information you need in order to reproduce this issue. If this is not the case then you should provide an indication of what's missing.

          I hope this time I don't have to wait 4 months in order to get at least some kind of comment from someone working on Jenkins.

          Show
          drieselliott Dries Elliott added a comment - I find it a bit astonishing that after four months someone finally looks at this issue and the first reaction is to just close it. I believe in my original description I provided all the information you need in order to reproduce this issue. If this is not the case then you should provide an indication of what's missing. I hope this time I don't have to wait 4 months in order to get at least some kind of comment from someone working on Jenkins.
          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.
          Hide
          jglick Jesse Glick added a comment -

          Please read the standard guide and provide a complete, self-contained, minimal set of steps to reproduce the problem from scratch, including all files, scripts, etc. etc. which would be needed for someone to see your problem occur locally without trying to guess at your intent, plus complete output of your own run for reference.

          Show
          jglick Jesse Glick added a comment - Please read the standard guide and provide a complete, self-contained, minimal set of steps to reproduce the problem from scratch, including all files, scripts, etc. etc. which would be needed for someone to see your problem occur locally without trying to guess at your intent, plus complete output of your own run for reference.
          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: