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

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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.

            Assignee:
            Unassigned
            Reporter:
            Dries Elliott
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: