We have a single Stash (git) repository for several artifacts that we build. The entire checkout of a single branch is 879 megabytes. However, many of our builds don't need this whole things, and some of them need only a very small part (e.g., a few files).
Is there some way to use the sparse checkout facility of git in order to check out only a single subdirectory using Bamboo (on my Stash repo)? I could then also trigger automatic builds by using the "Include/Exclude Files" option of a repo to monitor only the changed files in there.
Currently Bamboo does not support Sparse checkout for git. I've created this feature request on your behalf to have this feature added to the: https://jira.atlassian.com/browse/BAM-15097
Please add your comments to that issue and become a watcher so you can be automatically updated to work on this issue.
Thanks for these details and for creating the issue in the Atlassian system. I wonder if there is a way to pass the repo credentials and other information to a custom check-out script that will then be able to do a sparse checkout instead of the built-in checkout. Any thoughts here?
Hi Douglas, This should definitely be possible, but there will be some caveats. Currently coded checkout tasks utilize a git cache hosted on Bamboo server. The code is checked out by the server and cached, then revisions are checked against that, removing the limitation of needing to create the repo each time. If you are ok with this you can work around it by creating a script that does the checkout and calling that script with the 'script task' in Bamboo build config. You'll either need to hardcode credentials in or call them with a variable in bamboo each time. You'll also need to hardcode the path and you should be able to get revisions from environmental variables. tl;dr: it can be done, but is out of scope of our support team, so if something goes awry we may not be able to help. it will require a bit of work on your end and finagling with the script to get the remote agent to perform the full checkout. Thanks! Turner
Hi Turner, Thanks for the comments. For whatever reason, it seems that the working directory for each build (i.e. each run of the script) is identical and doesn't change for each execution. So that one run sees the junk files from the previous run still there. Is that desired behavior?
It is interesting. The regular workflow with Bamboo seems to keep a copy of the whole Git/Stash repository somewhere and then just use that for a local checkout. It would be much better if I could just tap into that instead of having an entire clone of the Git database here. I am not an expert on Git so I don't know how this all works, but I will have to figure out a better way.
Hi Douglas, This is what I was mentioning with Bamboo keeping a local cached copy. You'll be unable to tap into that without using the preconfigured checkout tasks or some seriously customized code/plugin. That was one of the caveats I mentioned initially. If you want to circumvent that in order to do a sparse checkout you'll forego the usefulness of that feature. Unfortunately, in this case, it seems to be one feature or the other until the improvement has been implemented. Thanks! Turner
Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs