-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
move git backend behind an interface #25752
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
Comments
this also might enable to use https://gitlab.com/gitlab-org/gitaly for us ... or split gitea int microservices ... (as one option) |
closing as dupe of #25070 |
Readun all the related issues&comments this is no dublicate ... |
This comment was marked as outdated.
This comment was marked as outdated.
I don't think we need an abstract layer for all the git operations, we could just have one for git command. |
The problem with the git.Command is, that it allows arbitrary functionality to git ... yes we can do cover it as interface ... and I would do so first ... but it makes a hard requirement for the git binary and that that related git backend implementation. So in the long run I want to have it used only within the git modules specific implementation. I agree that #25071 is higher in priority. This is about a long term goal, I want to refactor for the next versions ongoing (similar to how we migrated the http router) @lunny PS: we already only use the git.Command in our code and not provide any external interaction (witch would be bad security wise) ... so it's just about moving that specific functions into the same package |
IMO step 1 (Module Restructuring) is not necessary at the moment, while step 2 (Interface Definition) should be done first and needs more details. The reason IMO is: |
not a bad idea too :) I'll start with a smal pull and see if we can take it from there :D |
The Issue
The current issue involves the handling of interactions with bare Git repositories.
These interactions are currently integrated throughout the entire codebase.
The challenge revolves around unifying interactions with bare Git repositories while accommodating various backends and storage locations (for addressing storage locations, refer to Issue #25070).
The main objective is to create a central interface that consolidates actions related to Git, allowing for their distribution across different services. The aim is not an immediate replacement of the current implementation, but rather to enable such a transition in the future if necessary.
This proposed solution would also lay the foundation for potentially separating the handling of git-bare-repositories into its own microservice at a later point.
This approach brings several benefits, including the ability for independent development and maintenance of various Git implementations, improved security through Separation of Concerns, and overall enhanced maintainability.
Furthermore, this approach could make Gitea more scalable in conjunction with Issue #25070, enabling the possibility of utilizing different microservices for different repositories, potentially divided by patterns or settings like the starting letters of repositories.
Proposed Solution
The proposed solution involves a phased implementation approach:
Initial Streamlining: The first step is to create a more concise implementation. This includes relocating the specific functions currently present in the
modules/git
package to a lower package level.Interface Abstraction & Encapsulation: Following this, a fundamental interface will be established within the
modules/git
package at a higher package level. This interface will abstract essential functionalities, providing a clear structure for interaction.Roadmap to Implementation
Module Restructuring: Move the Git module (e.g.,
module/git
) to a submodule withinmodule/git
, and initiate the construction of the fundamental interface.Interface Definition: Define the interface for Git operations (e.g., Git open) incrementally, piece by piece, at
module/git
.Backend Segmentation: Segment the implementation of GoGit and NoGoGit, transitioning from using compile flags to run time settings.
Completing the Interface: Finalize the comprehensive interface and align it with the abstraction of Git storage sources (Issue #25070). This enables the assignment of distinct storage areas to various microservices based on repository names, enhancing scalability.
Integration Consideration: Evaluate the integration of libgit2 bindings as another backend behind a compile flag like sqlite support
tldr: This proposal aims to streamline our Git-Interaction in Gitea, leading to improved maintainability, flexibility, security and overall performance.
The text was updated successfully, but these errors were encountered: