Master runs out of disk space because of Jenkins files and libraries loading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Master runs out of disk space because of Jenkins files and libraries loading

Shiran
Hi all,

I've noticed that when my pipeline jobs start and load the Jenkins file and shared libraries, I end up with many copies of the entire repository being checked out on the master. This causes master to run out of disk space

 

More details:

  1. I use Git plugin to load the Jenkins file
  2. Loading shared libraries (stored under "vars" folder) starts at the beginning of the build, using this pipeline step:
    library identifier: 'utils', retriever: modernSCM([$class: 'GitSCMSource', credentialsId: '<   >', id: '<   >', remote: '<   >',
    traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'RefSpecsSCMSourceTrait', templates: [[value: "  "]]]]])

For example:

I have a job called "post_job" and my Jenkins files and libraries are stored in a repository called "my_repository".


After loading my Jenkins file:


/jenkins_home/jenkins/workspace/ post_job@script      

è contains all of my_repository content                                  


After loading my lobraries (I have 3: jobFlow, ManifestMap, utils):


/jenkins_home/jenkins/workspace/post_job@libs                         

jobFlow                          è contains all of my_repository content                                     

jobFlow@tmp                è empty                                         

manifestMap                 è contains all of my_repository content                                                                      

manifestMap@tmp       è empty                                                                       

utils                               è contains all of my_repository content                                                           

utils@tmp                     è empty                              

 


So I have my_repository content 4 times (!!) for each job that I have!

Any suggestions? please!
Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3f81e9ca-9e1c-437d-87f1-b3e3faeefe86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Master runs out of disk space because of Jenkins files and libraries loading

Mark Waite-2


On Thu, Jan 18, 2018 at 1:22 AM Shiran <[hidden email]> wrote:
Hi all,

I've noticed that when my pipeline jobs start and load the Jenkins file and shared libraries, I end up with many copies of the entire repository being checked out on the master. This causes master to run out of disk space


You'll probably need to add more disk space to your master.

There are changes that may reduce disc use, but even with those changes, Jenkins uses disc space and will continue to use disc space as you use it more.

Some of the techniques that can reduce disc use:
  • Use the GitHub branch source plugin (or the Bitbucket branch source plugin or the Gitea plugin) in the multi-branch pipeline job definition rather than the git plugin.  Those higher level branch source plugins obtain the Jenkinsfile without using a full checkout (so long as you don't disable lightweight checkout)
  • Maintain a git reference repository on each agent with a reasonably current copy of the repositories, then add the path to that reference repository to the job definition.  The CloudBees support article about reference repositories is very helpful.  I gave a 10 minute talk at Jenkins World 2017 "Git in the Large"  that may help.  I also gave a 10 minute talk at Jenkins World 2016 "Jenkins hints for large git repos".  Those two talks are available on youtube (2017, 2016) if needed
  • Honor the refspec on checkout (already done by multi-branch pipeline, not done by default for freestyle projects or matrix projects)
  • Keep your pipeline library git repositories small and focused on only providing pipeline libraries.  Don't include content in a pipeline library that is not needed for the pipeline library
  • Create a new git repository which uses "git lfs" instead of storing large files directly in the repository
Thanks,
 Mark Waite

 

More details:

  1. I use Git plugin to load the Jenkins file
  2. Loading shared libraries (stored under "vars" folder) starts at the beginning of the build, using this pipeline step:
    library identifier: 'utils', retriever: modernSCM([$class: 'GitSCMSource', credentialsId: '<   >', id: '<   >', remote: '<   >',
    traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'RefSpecsSCMSourceTrait', templates: [[value: "  "]]]]])

For example:

I have a job called "post_job" and my Jenkins files and libraries are stored in a repository called "my_repository".


After loading my Jenkins file:


/jenkins_home/jenkins/workspace/ post_job@script      

è contains all of my_repository content                                  


After loading my lobraries (I have 3: jobFlow, ManifestMap, utils):


/jenkins_home/jenkins/workspace/post_job@libs                         

jobFlow                          è contains all of my_repository content                                     

jobFlow@tmp                è empty                                         

manifestMap                 è contains all of my_repository content                                                                      

manifestMap@tmp       è empty                                                                       

utils                               è contains all of my_repository content                                                           

utils@tmp                     è empty                              

 


So I have my_repository content 4 times (!!) for each job that I have!

Any suggestions? please!
Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3f81e9ca-9e1c-437d-87f1-b3e3faeefe86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGd%3DJO0TCqrhTVQcYcarbJW9zC-2jW%2BvoFYh4nWGCXvRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.