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

refspec is not applied on clone (initial fetch)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • 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

      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.

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

              Created:
              Updated:
              Resolved: