Hi all,
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.
Thanks,
Doug
Hi Douglas,
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!
Turner
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found a setting that cleans the directory after each build. Shame it doesn't clean it BEFORE each build. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could probably run an inline script task at the start of the build plan before checking out the repo to clean the directory if it exists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any update on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
8 years later, not even a word or a reply to the Jira. What's going on?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simon says:
' If you need git sparse checkout you probably need a different VCS. Use SVN instead. Git is not for you. '
Simon out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.