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

Git clone cache #451

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Git clone cache #451

wants to merge 10 commits into from

Conversation

ipsi
Copy link
Contributor

@ipsi ipsi commented Nov 8, 2022

What does this PR do?

Add ability for Client to perform a git clone as a caching mechanism

To work around rate-limit issues, it is now possible for the Client to perform a Git Clone, and to look up certain requests in that cloned version of the repository. The clone is triggered by a request for a list of files (to prevent cloning the entire repository if we only need a single file), and has a default lifetime of 5 minutes.

This adds more complexity to the deployment of the client, as it is necessary to do a full clone of the repo, and potentially multiple clones of the repo (if, for example, multiple different revisions are needed) and this requires a potentially large amount of storage.

This feature is disabled by default, and is only available for GitHub and GitHub Enterprise when enabled.

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?

Screenshots

Additional questions

…anism

To work around rate-limit issues, it is now possible for the Client to perform a Git Clone, and to look up certain requests in that cloned version of the repository. The clone is triggered by a request for a list of files (to prevent cloning the entire repository if we only need a single file), and has a default lifetime of 5 minutes.

This adds more complexity to the deployment of the client, as it is necessary to do a full clone of the repo, and potentially multiple clones of the repo (if, for example, multiple different revisions are needed) and this requires a potentially large amount of storage.

This feature is *disabled* by default, and is only available for GitHub and GitHub Enterprise when enabled.
Also added some basic metrics for cache hits/misses, and exposed /metrics in the Client.
@ipsi ipsi requested a review from a team as a code owner November 8, 2022 10:55
kosti-snyk
kosti-snyk previously approved these changes Nov 8, 2022
kosti-snyk
kosti-snyk previously approved these changes Nov 9, 2022
Also remove retry attempts as I'm not 100% confident they'll work in every situation.
For some reason, apt autoremove will remove git, despite it being installed earlier.
Git creates a very particular SHA, so set that correctly.

Also passed back an object rather than a String because too many places would re-Stringify it, which caused problems.
@aarlaud aarlaud added the POC label Apr 19, 2023
@aarlaud aarlaud marked this pull request as draft September 25, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants