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

Use "lightweight checkout" when scanning multibranch pipeline

      The Jenkins Pipeline plugin has a feature known as "lightweight checkout", where the master only pulls the Jenkinsfile from the repo as opposed to pulling the entire repository.

      When I have several changes open in large repositories, checking out everything to master can result in Jenkins crashing if there is not enough space available.  This will also save us a whole load of time!

          [JENKINS-64199] Use "lightweight checkout" when scanning multibranch pipeline

          Claes Buckwalter added a comment - - edited

          Related reading: https://support.cloudbees.com/hc/en-us/articles/115002991272-Why-is-my-multibranch-project-cloning-the-whole-repository-on-the-master-

          Based on the Q&A section of the above page, you would still need space to store an initial clone the first time the job is run. Subsequent job runs would not pull all new changes though, only the new Jenkinsfile. Direct link:
          https://support.cloudbees.com/hc/en-us/articles/115002991272-Why-is-my-multibranch-project-cloning-the-whole-repository-on-the-master-#whyismypipelinejobcloningtheentirerepositoryonthemasterevenwheniselectalightweightcheckout

          Claes Buckwalter added a comment - - edited Related reading: https://support.cloudbees.com/hc/en-us/articles/115002991272-Why-is-my-multibranch-project-cloning-the-whole-repository-on-the-master- Based on the Q&A section of the above page, you would still need space to store an initial clone the first time the job is run. Subsequent job runs would not pull all new changes though, only the new Jenkinsfile. Direct link: https://support.cloudbees.com/hc/en-us/articles/115002991272-Why-is-my-multibranch-project-cloning-the-whole-repository-on-the-master-#whyismypipelinejobcloningtheentirerepositoryonthemasterevenwheniselectalightweightcheckout

          Nick Bulleid added a comment -

          Another solution to this would be to only use the Gerrit rest api when scanning for heads, and don't checkout any files onto master. I have a proof of concept for this which discovers changes on the server without a local checkout. This is similar to how the gitlab multibranch plugin works.

          Nick Bulleid added a comment - Another solution to this would be to only use the Gerrit rest api when scanning for heads, and don't checkout any files onto master. I have a proof of concept for this which discovers changes on the server without a local checkout. This is similar to how the gitlab multibranch plugin works.

          Nick Bulleid added a comment -

          After reading though JENKINS-33273 it seems there are two checkouts happening that could be skipped. One when scanning for heads, and one when trying to read the Jenkinsfile and any script files in the repo. The first can be replaced entirely with the gerrit rest api, as that provides the current revisions of all branches, tags and changes. The second is a bit trickier, as it requires implementing SCMFileSystem. This could probably be done using the Gitiles rest api, but not sure how much work is involved there.

          Nick Bulleid added a comment - After reading though JENKINS-33273 it seems there are two checkouts happening that could be skipped. One when scanning for heads, and one when trying to read the Jenkinsfile and any script files in the repo. The first can be replaced entirely with the gerrit rest api, as that provides the current revisions of all branches, tags and changes. The second is a bit trickier, as it requires implementing SCMFileSystem. This could probably be done using the Gitiles rest api, but not sure how much work is involved there.

            lucamilanesio Luca Domenico Milanesio
            jess Gordon Jess
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: