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

Multibranch pipeline does a full clone of the repository for any new branch

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      I have a multibranch pipeline using github SCM.

      Each time a build is triggered for a new branch, the job is doing a full clone of the repository (~ 3min in our case).

      However, if the branch already exists, the job only does a fetch of the repository (~5s in our case).

      We are using a single node (aka jenkins master). 

      Is there any solution without setting a reference repository up?

      For exemple, something like a git repo cache could exists on each node, and this repo is duplicated in the workspace before checking out the latest changes.

        Attachments

          Activity

          Hide
          ericf Eric Ferreira added a comment -

          I am facing this same issue – builds take upwards of 15-20 minutes as it tries to fetch the full repo each time.

          Show
          ericf Eric Ferreira added a comment - I am facing this same issue – builds take upwards of 15-20 minutes as it tries to fetch the full repo each time.
          Hide
          markewaite Mark Waite added a comment -

          Alternatives that can reduce the time to clone a repository are described in "Git in the Large". They include:

          • Narrow the refspec to exactly the required branch so that less history is copied in the checkout step of the Pipeline job (and don't forget 'honorRefspec on initial clone')
          • Reference repository to reduce code duplication (reference copy is already on disc)
          • Shallow clone so that less history is copied
          • Sparse checkout to save disc space in the working directory

          The jenkins-bugs repository I use for verification is over 40 MB but clones in seconds because I use narrow refspecs and the repository has many independent branches. A narrow refspec is less helpful for a repository that has fewer branches or has branches that are connected to one another.

          Show
          markewaite Mark Waite added a comment - Alternatives that can reduce the time to clone a repository are described in " Git in the Large ". They include: Narrow the refspec to exactly the required branch so that less history is copied in the checkout step of the Pipeline job (and don't forget 'honorRefspec on initial clone') Reference repository to reduce code duplication (reference copy is already on disc) Shallow clone so that less history is copied Sparse checkout to save disc space in the working directory The jenkins-bugs repository I use for verification is over 40 MB but clones in seconds because I use narrow refspecs and the repository has many independent branches. A narrow refspec is less helpful for a repository that has fewer branches or has branches that are connected to one another.

            People

            • Assignee:
              aaronjwhiteside Aaron Whiteside
              Reporter:
              mboillod manuel boillod
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: