Skip to content
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

Clone with NO history (shallow clones) #878

Closed
daruvin opened this issue Nov 23, 2018 · 9 comments
Closed

Clone with NO history (shallow clones) #878

daruvin opened this issue Nov 23, 2018 · 9 comments

Comments

@daruvin
Copy link

daruvin commented Nov 23, 2018

Issue:

We are utilizing r10k deploy environment and the modules with files are starting to accumulate history every time the file changes. Since modules now allow files to be placed in the directory, we are seeing the size of a full repo get quite large, very quickly.

Reason:

For example, a 100mb file that has been replaced 10 times within the git repo, now causes a 1gb (100mb*10) file download onto the puppet masters, where the history of the past 9 versions of the file is not really needed.

Impact:

Our deployments that used to be 1 - 4 minutes are now close to 1 hour when introducing a new module.
Keeping all the relevant files in the module repo makes it easy for development sharing and distribution to our 1 dozen Regional masters. Separating the files will require 3 changes. Put files onto MoM, add code to sync down to masters, modules deployment depends on first 2 being complete.
Alternative 1, purge all history and loose ability to revert to older versions.
Alternative 2, maintain 1 repo for development, merge changes to "live" repo, purge all the history in the live repo to keep it shallow.

Proposed solution

Git allows a shallow copy. Is there a way to get r10k to clone modules with no history : where depth is '1'
Would be great to have it as an option, wouldn't mind if it was the default behavior, since there is no development on the master servers, the history is not needed.

git clone --depth <depth> -b <branch> <repo_url>
git clone --depth 1 -b production <repo_url>

Git documentation: https://git-scm.com/docs/git-clone : search for depth

Example use: https://stackoverflow.com/questions/30001304/clone-git-repository-without-history/30001366

#65 : Similar issue, but now with a relevant use case

@akitty
Copy link

akitty commented Dec 10, 2018

libgit2 and rugged, the underlying git library r10k uses doesnt support shallow clones. So this will not be an easy change.

@daruvin
Copy link
Author

daruvin commented Dec 10, 2018

Considering the performance hit, 4 min << 60 mins, I think it would be a good reason to make the necessary changes. As the directories grow, the problem will keep getting bigger.

@radupantiru
Copy link

This would be very useful indeed.

@binford2k
Copy link
Contributor

it looks like libgit might be implementing shallow clones soon, libgit2/libgit2#3058

@github-actions
Copy link

This issue has been marked stale because it has had no activity for 60 days. The Puppet Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.

@halradaideh
Copy link

halradaideh commented Feb 9, 2023

it is implemented here libgit2/libgit2#3058
@akitty can we expect it on r10k?

@binford2k
Copy link
Contributor

Shallow cloning is now possible with libgit. We should implement it.

@binford2k binford2k reopened this Oct 18, 2023
@github-actions github-actions bot removed the stale label Oct 19, 2023
Copy link

This issue has been marked stale because it has had no activity for 60 days. The Puppet Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.

@github-actions github-actions bot added the stale label Dec 18, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2023
@kjetilho
Copy link

Although libgit2 now has support for shallow copies, the Ruby binding Rugged does not. This is issue libgit2/rugged#295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants