bad shallow clone performance with Bamboo and git

We recently switched from svn to git. We've tried enabling shallow clones in order to improve build speed when clean checkouts are required. Unfortunately, we have encountered two problems:

1. Fetches into shallow clones are slow -- they take ~10s on a full clone, but 2min on shallow clone. From the logs it appears that on every fetch, the agent is retrieving >1GB of data, even for very small changesets.

2. Shallow clones seem grow very large, very quickly. Some of our agents ran out disk space only one day after switching to shallow clones -- the repo size had grown to almost 50gb. We have found repo size in full clones to be relatively consistent.

For background, the git repo has ~200,000 commits; full clones are 20 gb, shallow clones are 4.1 gb. We have between 30 and 40 agents that check out this repository.

Has anyone experienced similar problems to this? Any tips or tuning advice?

2 answers

1 accepted

0 vote

It seems to me that using repository caching on agent is better option for you. (option can be found in Git Repository's advanced options) The way it works is that is creates a repository in agent directory that is a full clone. All remote updates go into that repository and because that repository is not destroyed between builds only the creation of cache takes long time. Then Bamboo does the checkout from that repository into the working dir, so even if you need clean checkout, it should be quite fast.

As for space requirements: obviously you need the space for the full clone (but if you use plan branches or share this repository across different plans the cache is shared). When doing checkout, we use the option to share the git objects between cache and the working dir, so the space in your working dir will be pretty much just the size of your code. (in other words: .git directory in the working dir will take as little space as possible)

0 vote

Which Bamboo version is it? Are you using native Git?

Bamboo 5.2.2. Git 1.7.1 is installed and in the bamboo user's path on the server and agents -- verbose logging seems to show Bamboo shelling out to the git binary.

Some more info -- it looks like every time someone pushes a change, even a small one, the shallow fetch downloads 1.17 gb of data from the server. Then the repo on disk grows by about the same amount. This does not happen when there are no changes -- the fetch is very fast, no change to repo size.

Suggest an answer

Log in or Join to answer
Community showcase
Louis De Jaeger
Posted yesterday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

61 views 2 2
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot