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

git plugin 2.5.2 breaks builds which use a narrow refspec but expect all refs were fetched

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Ubuntu, Jenkins 1.656, VSphere plugin 2.53, Git plugin 2.5.1 or 2.5.2
    • Similar Issues:

      Description

      The git plugin is unable to find revisions to build in environments where the current user is not Jenkins.
      This problem was introduced in git 2.5.1, 2 releases, and was not present in the 2.5.0 release.

      On builds where the build user is not Jenkins (the slave is running as a different user), the job aborts due to git errors.
      e.g:
      14:48:47 Started by user jmellor
      14:48:47 Starting limited count build: 1
      14:48:47 [EnvInject] - Loading node environment variables.
      14:48:47 Building remotely on robot-testbuilder-1 (robot-testbuilder) in workspace /var/lib/jenkins/workspace/soc-dashboard_dev_nightly
      14:48:50 Wiping out workspace first.
      14:48:50 Cloning the remote Git repository
      14:48:50 Cloning repository ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:48:50 > /usr/bin/git init /var/lib/jenkins/workspace/soc-dashboard_dev_nightly # timeout=10
      14:48:50 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:48:50 > /usr/bin/git --version # timeout=10
      14:48:50 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
      14:49:13 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
      14:49:14 > /usr/bin/git config --add remote.origin.fetch refs/heads/develop # timeout=10
      14:49:14 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
      14:49:14 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:49:14 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
      14:49:14 > /usr/bin/git rev-parse origin/develop^

      {commit} # timeout=10
      14:49:14 > /usr/bin/git rev-parse develop^{commit}

      # timeout=10
      14:49:14 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
      14:49:14 Retrying after 10 seconds
      14:49:24 Wiping out workspace first.
      14:49:24 Cloning the remote Git repository
      14:49:24 Cloning repository ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:49:24 > /usr/bin/git init /var/lib/jenkins/workspace/soc-dashboard_dev_nightly # timeout=10
      14:49:24 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:49:24 > /usr/bin/git --version # timeout=10
      14:49:24 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
      14:49:46 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
      14:49:46 > /usr/bin/git config --add remote.origin.fetch refs/heads/develop # timeout=10
      14:49:46 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
      14:49:46 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
      14:49:46 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
      14:49:46 > /usr/bin/git rev-parse origin/develop^

      {commit} # timeout=10
      14:49:46 > /usr/bin/git rev-parse develop^{commit}

      # timeout=10
      14:49:46 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

      My current workaround is to revert all the way back to git plugin 2.4.4 (which I had laying around), and the fault does not exhibit anymore. This build is also known to have been working for months with the git plugin 2.5.0 release.

        Attachments

        1. gerrit-config.PNG
          gerrit-config.PNG
          14 kB
        2. Parameters.PNG
          Parameters.PNG
          13 kB
        3. slave-config.PNG
          slave-config.PNG
          26 kB
        4. slave-config.PNG
          slave-config.PNG
          26 kB

          Issue Links

            Activity

            Hide
            markewaite Mark Waite added a comment - - edited

            John Mellor I was able to submit a pull request which I believe meets the use case you have (retain the 2.5.0 and prior behavior of pulling all references on initial clone) while giving users who need the flexibility to honor the refspec in initial clone. For a few days (until the job output expires from the jenkinsci infrastructure), you can download a prototype build.

            If it meets your use case, then I'll merge it to the master branch and be able to release it as an official fix for this bug.

            After posting that pull request, I performed some more detailed integration testing using a Docker image and many different bug verification jobs. Several of those jobs failed in unexpected ways. Those failures will need to be investigated and resolved before this pull request will be ready to merge to master for a release.

            Show
            markewaite Mark Waite added a comment - - edited John Mellor I was able to submit a pull request which I believe meets the use case you have (retain the 2.5.0 and prior behavior of pulling all references on initial clone) while giving users who need the flexibility to honor the refspec in initial clone. For a few days (until the job output expires from the jenkinsci infrastructure), you can download a prototype build . If it meets your use case, then I'll merge it to the master branch and be able to release it as an official fix for this bug. After posting that pull request, I performed some more detailed integration testing using a Docker image and many different bug verification jobs. Several of those jobs failed in unexpected ways. Those failures will need to be investigated and resolved before this pull request will be ready to merge to master for a release.
            Hide
            markewaite Mark Waite added a comment -

            The pull request has been through some additional interactive tests and has been merged to the master branch. A prototype build is available for you to test.

            Show
            markewaite Mark Waite added a comment - The pull request has been through some additional interactive tests and has been merged to the master branch. A prototype build is available for you to test.
            Hide
            alt_jmellor John Mellor added a comment -

            I’ve installed the prototype build, and come up with 4 use-case combinations that test the behaviour change.

            I believe that the prototype is working, as all 4 use-cases work as intended. Thumbs up!!!

            Show
            alt_jmellor John Mellor added a comment - I’ve installed the prototype build, and come up with 4 use-case combinations that test the behaviour change. I believe that the prototype is working, as all 4 use-cases work as intended. Thumbs up!!!
            Hide
            markewaite Mark Waite added a comment -

            John Mellor thanks very much.

            Show
            markewaite Mark Waite added a comment - John Mellor thanks very much.
            Hide
            markewaite Mark Waite added a comment -

            Fixed in git plugin 2.5.3 released 30 July 2016

            Show
            markewaite Mark Waite added a comment - Fixed in git plugin 2.5.3 released 30 July 2016

              People

              • Assignee:
                Unassigned
                Reporter:
                alt_jmellor John Mellor
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: