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

Perform lightweight checkout on tags

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None

      It seems like Bitbucket branches follow this convention but not Bitbucket tags. I create a Multibranch Pipeline job with the Branch Source set to Bitbucket Server. I have Discover Branches and Discover Tags set as well as the Build Strategies for building all regular branches and all tags regardless of age. 

      If I look in /var/lib/jenkins on the Jenkins Built-in node after a branch job runs I see a workspace_libs/ directory with the shared libraries that job imports cloned down. However, on tag jobs, I see that workspace_libs/ folder as well as a workspace_script/ folder. That workspace_script/ folder has the entire repo cloned down in order to access the Jenkinsfile it seems.

      To cut down on clone size I have changed my job configuration to sparse checkout just the Jenkinsfile but I still get the full .git/ folder under workspace_script/ which for some of our repos can be pretty big (~380 MB - it’s a large C++ project so git-lfs won’t help us here). I can change the clone depth as well but that has the consequences of not populating the “changes” field correctly if the shallow history depth of the clone is smaller than the number of commits since the last job run (not the end of the world there but not ideal). 

      For what it’s worth, our pipelines have their own stage in a node{} block that perform their own clone on the builder node the job chooses so there’s no need for us to use that workspace_scripts/ folder. We cleanup on the builder nodes after the jobs run so that’s not a problem. The Built-in node is where the growth seems to happen that we can’t control as well as I’d hope. 

      I would imagine branches and tags should work the same right? Branches don’t seem to need that workspace_script/ folder at all in order to access and use the Jenkinsfile. Is this a bug in how the tag jobs are processed or is there a reason behind that difference in behavior?

      Thanks! Im on mobile now so can’t provide server details or screenshots but will do so first thing tomorrow morning. 

      Note: workspace_libs/ and workspace_scripts/ actually have a double underscore in their name but formatting issues here preventing me from typing that out. I called them out above with the single underscore but just know that the server shows double as expected.

            Unassigned Unassigned
            j17359 Michael Steppe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: