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

Shallow clone on master when running job across slaves

XMLWordPrintable

      Right now we use Jenkinsfiles for all of our branches and we run these jobs across slaves.
      Our master does no jobs, it's meant to just coordinate the slaves.

      However because each branch is built, that means the master clones our entire repository per branch. This takes up a lot of disk space.

      Is there a way to do a shallow clone on the master so that it only knows about the branch that it's building? It doesnt make sense to clone the whole repo per branch when the branch is a subset of the repo itself.

      https://paste.fedoraproject.org/paste/bmZqN6-Mciz-oPhGuf1aKV5M1UNdIGYhyRLivL9gydE=

      183M    /var/lib/jenkins/workspace/redact-EKFU2VZFRWU4KXB4654FWURV2Q4AOPB2UXMBLUPEMX77NXWGZGDA@script
      175M    /var/lib/jenkins/workspace/lth_4636-product-to-service-R7DOH3YG2S3PCNRVQ4OHWJEQLMV4WUVPZJY6NXITQX7BCI63RAQQ@script
      732K    /var/lib/jenkins/workspace/redact-2DDF7H6TH77GDLANNM7J5JNMKMBXUZQGZUBSBQW7HKRZZDTOISYQ@script
      175M    /var/lib/jenkins/workspace/play-0-if-no-cases-for-year-YVL7UHVREPETGHMM6SUR7ZYDXOAYPWSLHTW24NKWJALUS5LGUXUQ@script
      6.2G    /var/lib/jenkins/
      

      every branch is 175+MB on the master because each branch is a git clone. I'd like to only get the context of a branch on the master as well as the slave.

      Also, on the slave I'm unsure how to do a shallow clone via Jenkinsfile DSL without specifying all of the other information, such as User credentials, credentials Id, etc.

      I'd like to just have

      node('ec2') {
        stage('Checkout') {
          checkout scm //something about adding shallow clone here
        }
      }
      

            Unassigned Unassigned
            myoung34 marc young
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: