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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: