{"id":12599,"date":"2020-04-01T08:57:48","date_gmt":"2020-04-01T12:57:48","guid":{"rendered":"https:\/\/qxf2.com\/blog\/?p=12599"},"modified":"2020-04-01T08:57:48","modified_gmt":"2020-04-01T12:57:48","slug":"jenkins-sparse-checkout","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/jenkins-sparse-checkout\/","title":{"rendered":"Sparse Checkout using Jenkins"},"content":{"rendered":"<p>I was recently working on a project where I required only a particular folder inside a bitbucket repository to be cloned and tracked on the server. This was when I stumbled upon the sparse checkout feature that Jenkins offered. I decided to write this short post so that it might help you in case you have a similar requirement as me.<\/p>\n<p>I have the following folder structure:<br \/>\n<a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/folderstruct.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/folderstruct.jpg\" alt=\"\" width=\"311\" height=\"346\" class=\"alignnone size-full wp-image-12621\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/folderstruct.jpg 311w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/folderstruct-270x300.jpg 270w\" sizes=\"auto, (max-width: 311px) 100vw, 311px\" \/><\/a><br \/>\nHere,I would like to clone and track only the <strong>survey<\/strong> folder highlighted above.<br \/>\nHere is how you can go about doing this,<br \/>\n1) Start off by creating a new freestyle project<br \/>\n2) Under the configure page, navigate to <strong>source code management<\/strong> section.<br \/>\n3) Here, click on the <strong>git<\/strong> option. Enter the repository URL followed by the credentials and the branch that you would like to build.<br \/>\n4) Now, besides the additional behaviour tab click on the <strong>Add<\/strong> dropdown menu, and select <strong>Sparse Checkout path <\/strong>option.<br \/>\n5) A textbox will be displayed. Here, enter the path to the folder that you would like to clone.<br \/>\n<a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins.jpg\" alt=\"\" width=\"1504\" height=\"673\" class=\"alignnone size-full wp-image-12600\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins.jpg 1504w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins-300x134.jpg 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins-768x344.jpg 768w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2020\/03\/sparse-checkout-jenkins-1024x458.jpg 1024w\" sizes=\"auto, (max-width: 1504px) 100vw, 1504px\" \/><\/a><br \/>\nGo ahead and save your configuration<br \/>\n6) Click on <strong>Build Now<\/strong>.<br \/>\nOnly the folder which was specified would be cloned and tracked on the server.<\/p>\n<p>And that&#8217;s it, you successfully did a sparse checkout using Jenkins!<br \/>\nFeel free to ask any further queries you have.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was recently working on a project where I required only a particular folder inside a bitbucket repository to be cloned and tracked on the server. This was when I stumbled upon the sparse checkout feature that Jenkins offered. I decided to write this short post so that it might help you in case you have a similar requirement as [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,226],"tags":[],"class_list":["post-12599","post","type-post","status-publish","format-standard","hentry","category-jenkins","category-sparse-checkout"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/12599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=12599"}],"version-history":[{"count":12,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/12599\/revisions"}],"predecessor-version":[{"id":12627,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/12599\/revisions\/12627"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=12599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=12599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=12599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}