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

git-plugin fails to expand variables in refspec on initial clone

    • Git plugin 4.5.1 released 26 Dec 2020

      Git plugin fails to expand variables in the refspec setting. A sure way to trigger the bug is to enable both "Honor refspec on initial clone" and "Wipe out repository & force clone". The config is attached.

      Here's an excerpt from the log to the top-level job:

       

       > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
       > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
       > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
       > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
      Cleaning workspace
       > git rev-parse --verify HEAD # timeout=10
      No valid HEAD. Skipping the resetting
       > git clean -fdx # timeout=10
      Pruning obsolete local branches
      Fetching upstream changes from http://stash/scm/rob/testrepository.git
       > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master6 --prune # timeout=10
      
      

      Note that ${BUILD_ID} is not expanded in the first commit, but is expanded at the end where branch specifier is being used.

       

      Remove "Wipe out repository & force clone", and the variable is being expanded now.

       

       > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master9 --prune # timeout=10
       > git rev-parse refs/remotes/origin/master9^{commit} # timeout=10
       > git rev-parse refs/remotes/origin/refs/heads/master9^{commit} # timeout=10
      

       

      It may seem a trivial issue with ${BUILD_ID}, but it's actually a big problem when I try pulling ${sourceCommitHash} with stash-pull-request-builder. That's why I consider it a major bug. It prevents me from using the correct commit received from Stash REST API and makes me use a suboptimal solution that involves a race condition.

      I believe git-plugin should always expand variables in the refspec setting on its own, without relying on the shell.

       

          [JENKINS-56063] git-plugin fails to expand variables in refspec on initial clone

          Pavel Roskin created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Labels Original: expansion git-plugin variables New: expansion git-plugin newbie-friendly variables
          Rishabh Budhouliya made changes -
          Assignee New: Rishabh Budhouliya [ rishabhbudhouliya ]
          Rishabh Budhouliya made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Rishabh Budhouliya made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Deepansh Nagaria made changes -
          Description Original: Git plugin fails to expand variables in the refspec setting. A sure way to trigger the bug is to enable both "Honor refspec on initial clone" and "Wipe out repository & force clone". The config is attached.

          Here's an excerpt from the log to the top-level job:

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
           > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
          Cleaning workspace
           > git rev-parse --verify HEAD # timeout=10
          No valid HEAD. Skipping the resetting
           > git clean -fdx # timeout=10
          Pruning obsolete local branches
          Fetching upstream changes from http://stash/scm/rob/testrepository.git
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master6 --prune # timeout=10

          {code}
          Note that ${BUILD_ID} is not expanded in the first commit, but is expanded at the end where branch specifier is being used.

           

          Remove "Wipe out repository & force clone", and the variable is being expanded now.

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master9 --prune # timeout=10
           > git rev-parse refs/remotes/origin/master9^{commit} # timeout=10
           > git rev-parse refs/remotes/origin/refs/heads/master9^{commit} # timeout=10
          {code}
           

          It may seem a trivial issue with ${BUILD_ID}, but it's actually a big problem when I try pulling ${sourceCommitHash} with stash-pull-request-builder. That's why I consider it a major bug. It prevents me from using the correct commit received from Stash REST API and makes me use a suboptimal solution that involves a race condition.

          I believe git-plugin should always expand variables in the refspec setting on its own, without relying on the shell.

           
          New:
          0...........................................................................0Git plugin fails to expand variables in the refspec setting. A sure way to trigger the bug is to enable both "Honor refspec on initial clone" and "Wipe out repository & force clone". The config is attached.

          Here's an excerpt from the log to the top-level job:

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
           > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
          Cleaning workspace
           > git rev-parse --verify HEAD # timeout=10
          No valid HEAD. Skipping the resetting
           > git clean -fdx # timeout=10
          Pruning obsolete local branches
          Fetching upstream changes from http://stash/scm/rob/testrepository.git
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master6 --prune # timeout=10

          {code}
          Note that ${BUILD_ID} is not expanded in the first commit, but is expanded at the end where branch specifier is being used.

           

          Remove "Wipe out repository & force clone", and the variable is being expanded now.

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master9 --prune # timeout=10
           > git rev-parse refs/remotes/origin/master9^{commit} # timeout=10
           > git rev-parse refs/remotes/origin/refs/heads/master9^{commit} # timeout=10
          {code}
           

          It may seem a trivial issue with ${BUILD_ID}, but it's actually a big problem when I try pulling ${sourceCommitHash} with stash-pull-request-builder. That's why I consider it a major bug. It prevents me from using the correct commit received from Stash REST API and makes me use a suboptimal solution that involves a race condition.

          I believe git-plugin should always expand variables in the refspec setting on its own, without relying on the shell.

           
          Mark Waite made changes -
          Description Original:
          0...........................................................................0Git plugin fails to expand variables in the refspec setting. A sure way to trigger the bug is to enable both "Honor refspec on initial clone" and "Wipe out repository & force clone". The config is attached.

          Here's an excerpt from the log to the top-level job:

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
           > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
          Cleaning workspace
           > git rev-parse --verify HEAD # timeout=10
          No valid HEAD. Skipping the resetting
           > git clean -fdx # timeout=10
          Pruning obsolete local branches
          Fetching upstream changes from http://stash/scm/rob/testrepository.git
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master6 --prune # timeout=10

          {code}
          Note that ${BUILD_ID} is not expanded in the first commit, but is expanded at the end where branch specifier is being used.

           

          Remove "Wipe out repository & force clone", and the variable is being expanded now.

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master9 --prune # timeout=10
           > git rev-parse refs/remotes/origin/master9^{commit} # timeout=10
           > git rev-parse refs/remotes/origin/refs/heads/master9^{commit} # timeout=10
          {code}
           

          It may seem a trivial issue with ${BUILD_ID}, but it's actually a big problem when I try pulling ${sourceCommitHash} with stash-pull-request-builder. That's why I consider it a major bug. It prevents me from using the correct commit received from Stash REST API and makes me use a suboptimal solution that involves a race condition.

          I believe git-plugin should always expand variables in the refspec setting on its own, without relying on the shell.

           
          New: Git plugin fails to expand variables in the refspec setting. A sure way to trigger the bug is to enable both "Honor refspec on initial clone" and "Wipe out repository & force clone". The config is attached.

          Here's an excerpt from the log to the top-level job:

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
           > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master${BUILD_ID} # timeout=10
           > git config remote.origin.url http://stash/scm/rob/testrepository.git # timeout=10
          Cleaning workspace
           > git rev-parse --verify HEAD # timeout=10
          No valid HEAD. Skipping the resetting
           > git clean -fdx # timeout=10
          Pruning obsolete local branches
          Fetching upstream changes from http://stash/scm/rob/testrepository.git
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master6 --prune # timeout=10

          {code}
          Note that ${BUILD_ID} is not expanded in the first commit, but is expanded at the end where branch specifier is being used.

           

          Remove "Wipe out repository & force clone", and the variable is being expanded now.

           
          {code:java}
           > git fetch --no-tags --progress http://stash/scm/rob/testrepository.git +refs/heads/master:refs/remotes/origin/master9 --prune # timeout=10
           > git rev-parse refs/remotes/origin/master9^{commit} # timeout=10
           > git rev-parse refs/remotes/origin/refs/heads/master9^{commit} # timeout=10
          {code}
           

          It may seem a trivial issue with ${BUILD_ID}, but it's actually a big problem when I try pulling ${sourceCommitHash} with stash-pull-request-builder. That's why I consider it a major bug. It prevents me from using the correct commit received from Stash REST API and makes me use a suboptimal solution that involves a race condition.

          I believe git-plugin should always expand variables in the refspec setting on its own, without relying on the shell.

           
          Mark Waite made changes -
          Status Original: In Review [ 10005 ] New: In Progress [ 3 ]
          Mark Waite made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Mark Waite made changes -
          Remote Link New: This issue links to "PR 1013 - extending Rishabh's work (Web Link)" [ 26363 ]

            rishabhbudhouliya Rishabh Budhouliya
            proski Pavel Roskin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: