-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a shallow clone example for checkout step for 2.0 #2040
Comments
@Aghassi this is truly fantastic! In regards to putting this in docs, I think you're right to have some questions about where to put this. Because we can't guarantee 100% functionality, I hesitate to commit this to our official docs. However! Here are some ideas:
Thanks again! |
Googled this same question just today and this result came up. This would be lovely. We have a legacy Git repo that has a 500MB checkout due to some accidents in the past (80MB CSS files!) Fixing the repo would be best but it's a hard thing with a team of devs and multiple environments already using this repo. Shallow cloning is our temporary solution, and it would be great if CircleCI could support it natively.
Could you post here any updates as they happen? And thanks @Aghassi! |
WELL @Aghassi @quicksketch here is the requested update! But it is not happy news! The stance of our developers is this: GitHub hates it when we shallow clone. They're CPU expensive and don't want it to become A Thing — to the extent that they'll automatically rate limit any project that is doing too much of it. On top of that, it's not always necessarily faster than a full clone. SO. At the moment, we don't have any real plans to bake this in. Blah! |
@smart-alek Unfortunate, but fair. I work in enterprise, so we don't experience that side of the issue since we run GitHub Enterprise. At least for the enterprise offering, it would be nice. For the public offering, I can't speak much to it. The script above is fully working for both Forks and normal PRs. People can do with it as they please. |
Excellent @Aghassi, thanks for understanding! |
It would be great if this can become official on CircleCI. We currently use Travis-CI but looking to migrate to CircleCI and I noticed today that CircleCI does a full clone (our history is 2GB!). Travis-CI does a shallow clone by default with a depth of 50 and you can customize it if needed. It is not a 1 to 1 comparison but on Travis-CI the checkout takes just over 1 second where on CircleCI the checkout takes over a minute. |
Hi folks, this conversation does seem to be evolving beyond a purely docs issue. Can I ask a motivated participant write up a summary and add it to our Ideas page? |
@smart-alek Done Idea #: CCI-I-254 |
Not the good "idea", here's the good one: CCI-I-254 |
For those interested in using a shallow checkout, I just published an orb under our organization @ https://github.com/mavenlink/orbs/blob/926f713b56483c0a3379261e901ae883467ab363/src/git/orb.yml Pretty easy to use:
|
Hey all, |
I’ve been using this method for over a year on GitHub enterprise and never had an issue. I don’t recommend caching the git repo. |
There's also orbs to achieve shallow cloning, https://circleci.com/orbs/registry/orb/guitarrapc/git-shallow-clone for example |
It's been a while since this happened, and I assume Github has changed their mind on that as the default of the checkout github action is to have a depth of 1 when cloning:
|
Your orb doesn't work unfortunately, path issues, you seem to be trying to |
@Pi-George The path is a parameter (
https://github.com/mavenlink/orbs/blob/14c295c3df153a6a34749fcf9a0958d3e42bd668/src/git/orb.yml#L52 |
I've just found this nice article on the Github blog. As previously stated they also say shallow clones are expensive BUT a valid way to handle repositories which will be deleted after usage:
I think this opens room for improvement of the standard CircleCI configuration. |
Has anyone found a configuration of this command that works for windows VMs? I have shallow checkouts working in all of our jobs except those running in windows VMs. I've tried to convert it to PowerShell and still no luck, getting |
@juanca if I try to
because I want to clone a monorepo and work in a certain subfolder, I always get the error
because the |
Many users have been asking about shallow clones in 2.0. I've made a modification to the existing
checkout
command that allows just this. However, I'm not sure where to put it in the docs. It does work, though not 100% (forks cause issues). However, it does work to do checkouts in PRs etc. It helped us reduce a checkout from 7 min. to 10s.Put the following at the top of the config file.
And then the user can checkout using this command by running the below instead of using the
checkout
commandSorry for the spacing issues. You get the idea though. It would be nice to be able to have this option backed in, but at least this would get users who need it off the ground.
The text was updated successfully, but these errors were encountered: