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

Limit Rugged Control Repo refspec #1412

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanmil
Copy link
Contributor

@seanmil seanmil commented Dec 2, 2024

Some Git platforms (e.g. GitLab) store additional references beyond the ones typically found in refs/heads for various tracking/historical reference purposes. For Control Repos which have been around a long time these additional refs can number in the tens of thousands. Refs that numerous seem to cause issues with some versions of Rugged being unable to properly clone and reference the Control Repo.

This patch limits Control Repo reference fetching to refs/heads, which is all R10K should need anyways.

See https://docs.gitlab.com/ee/development/gitaly.html#gitlab-specific-references for details on some of these additional references.

@seanmil seanmil requested review from a team as code owners December 2, 2024 18:42
Some Git platforms (e.g. GitLab) store additional references
beyond the ones typically found in refs/heads for various
tracking/historical reference purposes. For Control Repos
which have been around a long time these additional refs
can number in the tens of thousands. Refs that numerous seem
to cause issues with some versions of Rugged being unable
to properly clone and reference the Control Repo.

This patch limits Control Repo reference fetching to
refs/heads, which is all R10K should need anyways.

See https://docs.gitlab.com/ee/development/gitaly.html#gitlab-specific-references
for details on some of these additional references.
@justinstoller
Copy link
Member

Thanks for the PR, Sean. I'll try to figure this out this week. I'm surprised that the :prune => true isn't cleaning up the old refs. I also think we'd need refs/tags/* as well. But I'll try to verify those questions.

@seanmil
Copy link
Contributor Author

seanmil commented Dec 3, 2024

Thanks for the PR, Sean. I'll try to figure this out this week. I'm surprised that the :prune => true isn't cleaning up the old refs. I also think we'd need refs/tags/* as well. But I'll try to verify those questions.

Hi Justin, thanks for the quick update.

The :prune => true wouldn't clean up all of these references because a number of them are permanent references GitLab uses to point to key points in time in the repository such as commits used to show MR state, commit refs for pipeline jobs, the commit at which a (GitLab) "project environment" was deployed, etc.. Those just accumulate as the project has more and more history associated with it, so they aren't eligible for pruning. You can remove them from GitLab (as I did to work around my critical issue at the time) but it isn't a normal procedure and as I recall requires admin-level console access to GitLab.

As far as the refspec, adding refs/tags/* may be a good idea regardless, but I'm not sure I've heard of any Control Repo workflows that deploy from tags instead of branch names. That particular bit of code is, I believe, only used to clone/fetch the bare repository containing the control repo itself. The clone/fetch for any of the repositories managed by the control repo is in the lib/r10k/git/working_repository.rb file instead. It has been too long since I did this work to remember with clarity, but I believe I based the refspec based on what I saw when running the git --mirror command in lib/r10k/git/shellgit/bare_repository.rb. Making the refspec configurable would be okay too, but that seems like a lot of additional work for questionable value.

Hope that helps, thanks for taking a look at it!

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

Successfully merging this pull request may close these issues.

2 participants