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

refspec is not applied on clone (initial fetch)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
    • Environment:
      Jenkins Latest and greatest (1.614) / Older but stable (1.596.3)
      git-client 1.17.1 / 1.16.1
      git-plugin 2.3.5 / 2.3.4
    • Similar Issues:

      Description

      As far as i can see the refspec is not used on the initial clone.
      Here is the relevant extract from a build with a cleaned workspace:

      Cloning the remote Git repository
      Cloning repository gitserver:/data/git/MyProject.git
       > /usr/bin/git init /data/jenkins/workspace/myjob.checkoutrefspec # timeout=10
      Fetching upstream changes from gitserver:/data/git/MyProject.git
       > /usr/bin/git --version # timeout=10
      using GIT_SSH to set credentials Jenkins private key
       > /usr/bin/git fetch --tags --progress gitserver:/data/git/MyProject.git +refs/heads/*:refs/remotes/origin/*
       > /usr/bin/git config remote.origin.url gitserver:/data/git/MyProject.git # timeout=10
       > /usr/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > /usr/bin/git config remote.origin.url gitserver:/data/git/MyProject.git # timeout=10
      

      this is directly followed by

      Fetching upstream changes from gitserver:/data/git/MyProject.git
      using GIT_SSH to set credentials Jenkins private key
       > /usr/bin/git fetch --tags --progress gitserver:/data/git/MyProject.git +refs/heads/development:refs/remotes/origin/development
       > /usr/bin/git rev-parse origin/development^{commit} # timeout=10
      Checking out Revision c5280c05a01a61f2ae43e46a1ee398be27cdc14e (origin/development)
       > /usr/bin/git config core.sparsecheckout # timeout=10
       > /usr/bin/git checkout -f c5280c05a01a61f2ae43e46a1ee398be27cdc14e
      First time build. Skipping changelog.
      

      wich is using the configured refspec. This fetch is used correctly in later builds.

      We have some old and heavy branches (with some binaries) that we do not want to get fetched at any time. As of today this is only possible with sparse checkouts, but they have the drawback that we can not push tags back to remote after the build.

        Attachments

          Issue Links

            Activity

            Hide
            simonmweber Simon Weber added a comment -

            This is particularly brutal when using "delete repository and force clone" with shallow clones.

            Is anyone planning to tackle this soon?

            Show
            simonmweber Simon Weber added a comment - This is particularly brutal when using "delete repository and force clone" with shallow clones. Is anyone planning to tackle this soon?
            Show
            timocov Eugene Timokhov added a comment - Same https://issues.jenkins-ci.org/browse/JENKINS-31393 ?
            Hide
            dageissl Daniel Geißler added a comment -

            Seems to be solved by JENKINS-31393 (and explained in JENKINS-33140), so this bug can be closed.

            Show
            dageissl Daniel Geißler added a comment - Seems to be solved by  JENKINS-31393 (and explained in JENKINS-33140 ), so this bug can be closed.
            Hide
            markewaite Mark Waite added a comment -

            Fixed in git plugin 2.5.1.

            The git plugin intentionally fetches all refspecs on initial clone, unless "Advanced clone behaviours" is enabled and sets "Honor refspec on initial clone". The use case described in JENKINS-36507 (and others like it) required that the plugin retain its default behavior of always fetching all refspecs on initial clone.

            Show
            markewaite Mark Waite added a comment - Fixed in git plugin 2.5.1. The git plugin intentionally fetches all refspecs on initial clone, unless "Advanced clone behaviours" is enabled and sets "Honor refspec on initial clone". The use case described in  JENKINS-36507  (and others like it) required that the plugin retain its default behavior of always fetching all refspecs on initial clone.

              People

              • Assignee:
                Unassigned
                Reporter:
                dageissl Daniel Geißler
              • Votes:
                5 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: