Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/proto/go
AgeCommit message (Collapse)Author
2022-05-09proto: Enforce comment-linting for RPC definitionsPatrick Steinhardt
Enforce that RPC definitions must have a comment and add a placeholder for all instances where such a comment is missing.
2022-05-06tools: Move Protoc plugins into top-level `tools/` directoryPatrick Steinhardt
The Protoc plugins we use are hidden away deep into the `proto/` directory, which makes it very hard to discover them when one doesn't already know about their existence. Let's move them into a new top-level `tools/` directory.
2022-05-06protoc-gen-gitaly-lint: Absorb internal `linter` packagePatrick Steinhardt
There is no real reason why the `protoc-gen-gitaly-lint` package requires another internal package to provide the actual logic. Furthermore, we want to move this plugin into a top-level `tools` directory to make it easier to discover. Absorb the `linter` package to make it easier to move the code around.
2022-05-06protoc-gen-gitaly: Split up plugin by functionalityPatrick Steinhardt
The `protoc-gen-gitaly` plugin provides two different functionalities: - It lints our Protobuf definitions to make sure they conform to our coding guidelines. - It generates a `protolist.go` file, which contains a list of all Protobuf files. This is conflating two otherwise unrelated concerns, and thus makes the divide between our `proto` and `lint-proto` Makefile targets a bit blurry. Furthermore, it is creating a cyclic dependency: the linting logic requires that the Protobuf files must have already been generated, but we can only generate them when we have plugin compiled. Prepare for a fix by splitting up functionality of this plugin into two separate plugins: `protoc-gen-gitaly-lint` is responsible for linting our definitions, while `protoc-gen-gitaly-protolist` will generate the list of Protobuf files.
2022-05-03Merge branch 'jc-cherry-pick-structured-errors-proto' into 'master'John Cai
proto: Add CherryPickError type for UserCherryPick structured errors See merge request gitlab-org/gitaly!4497
2022-05-03proto: Add UserCherryPickError type for UserCherryPick structured errorsJohn Cai
In UserCherryPick, there are some error conditions where instead of returning an error, we return OK and embed the error in the response. Instead of doing this, we want to return structured errors. This change adds the proto definition for this error.
2022-05-03Merge branch 'pks-check-objects-exist-improvements' into 'master'Sami Hiltunen
commit: Various fixes for `CheckObjectsExist()` See merge request gitlab-org/gitaly!4510
2022-05-03proto: Remove deprecated `PackObjectsHook()` RPCPatrick Steinhardt
The `PackObjectsHook()` RPC is deprecated and its implementation has been removed in 473e3540f (Deprecate PackObjectsHook, 2021-10-25). Now that v15.0 is close, let's also remove the Protobuf definitions. Changelog: removed
2022-05-03commit: Do not ignore revisions of the initial requestPatrick Steinhardt
The `CheckObjectsExist()` RPC is a streaming RPC: the caller may send one or more requests to check sets of revisions. This is done such that this RPC call also works in the context where millions of revisions need to be checked in a single call, which could otherwise exceed the gRPC memory limitations. The current behaviour is a tad weird though: revisions sent as part of the initial request are completely ignored. This doesn't feel right as the caller would now be forced to _always_ send at least two messages. It's also not documented to be the case, and last but not least all our other streaming RPCs don't do it this way either. So let's fix this behaviour and also honor revisions sent of the initial request. Changelog: fixed
2022-04-29Rename repository-service.proto to repository.protoJames Fargher
This makes the naming of all proto files consistent.
2022-04-29Automatically lint proto filesJames Fargher
2022-04-22Merge branch 'fix-typo-proto-file' into 'master'Toon Claes
Fix typo in documentation of UserCommitFilesRequestHeader See merge request gitlab-org/gitaly!4422
2022-04-19Add proto definitions for MarkUnverified RPCSami Hiltunen
With the introduction of metadata verification, Praefect needs a tool to manually mark a repository as needing verification immediately rather than after the specified verification interval has passed. That tool will require a new RPC that it can call achieve its goal. This commit adds the proto definitions for MarkUnverified RPC which can be called to either mark a single repository by ID, a whole virtual storage, or a whole storage as needing verification. Changelog: added
2022-04-19Merge branch 'jc-limit-error-proto' into 'master'Sami Hiltunen
proto: Add LimitError as a structured error See merge request gitlab-org/gitaly!4476
2022-04-14proto: Add LimitError as a structured errorjc-limit-error-protoJohn Cai
When Gitaly enforces a limit, either due rate limiting or concurrency limiting, it needs to be able to return an error to its clients to provide context into why it failed so that clients can then inform its callers of why the call failed. Changelog: added
2022-04-13Expose VerifiedAt via GetRepositoryMetadata proto definitionsSami Hiltunen
Administrators may want to know when a replica has been last verified by Praefect. GetRepositoryMetadata RPC is called by the 'metadata' sub-command to retrieve infromation about a repository and its replicas from Praefect's database. This commit adds the proto definitions for exposing the last verification time of replicas to the metadata sub-command. Changelog: changed
2022-04-06commit: Add CheckObjectsExist RPCJohn Cai
When pushing commits to a repository, access checks are run. In order to use the quarantine directory, we need a way to filter out revisions that a repository already has in the case that a packfile sends over objects that already exists on the server. In this case, we don't need to check the access. Add an RPC that when given a list of revisions, returns the ones that already exist in the repository, and the ones that do not exist in the repository. Changelog: added
2022-04-05Add a range parameter to Commit.RawBlameRequestNick Thomas
2022-03-31Merge branch 'pks-proto-introduce-maintenance-operations' into 'master'Patrick Steinhardt
proto: Introduce new "maintenance" RPC type Closes #4079 See merge request gitlab-org/gitaly!4399
2022-03-30internalgitaly: WalkRepos to return last accessed timestampJohn Cai
In order to make a decision on which repositories to clean up, Praefect's repocleaner will match repository paths with what it sees in the database. If it doesn't see a record in the database, that means Praefect doesn't know about this repository. However, it could be the case that a repository has just been created and the record for it doesn't yet exist in the database. In order for repocleaner to know, it needs the information to be returned from Gitaly. Add a field in the RPC response, and return the last modified date on the refs/ dir so we can use it as a proxy for when the repository was created.
2022-03-30proto: Mark related RPCs as maintenance operationsPatrick Steinhardt
We've got all the infrastructure in place now to handle maintenance operations specially in our infrastructure. Mark all RPCs which are maintenance-related as maintenance operations to switch them to use the new infrastucture. Note that we've still got a feature flag which toggles between old and new routing behaviour for these RPCs. Changelog: changed
2022-03-30proto: Introduce new "maintenance" RPC typePatrick Steinhardt
Gitaly classifies RPC calls into two different types: - Accessors are all RPCs which access data without modifying the on-disk state of the repository. - Mutators perform changes in repositories to modify the state as visible to the user. Our maintenance RPCs don't fit into either category though: they modify on-disk data, but the end result as visible to the user shouldn't be changed by this. They should instead be considered as idempotent with regards to user-visible behaviour. Right now those RPCs are labelled as mutators. This is not a good fit though: we have to disable transactional voting because it doesn't make sense to vote on the on-disk representation of a repository, which is not deterministic. As a consequence, we only route those requests to the primary node and replicate the change afterwards, which is not an ideal strategy. Introduce a new RPC type for these maintenance-style RPCs. This will easily allow us to implement behaviour that's different from both accessors and mutators in a subsequent commit. Note that this commit doesn't yet change the type of any of our RPC calls. First, we must adapt our architecture to handle the new type.
2022-03-21operations: Always use structured errors for UserSquashPatrick Steinhardt
With d88d29185 (operations: Return error from UserSquash when resolving revisions fails, 2022-03-01), we have converted UserSquash to return structured errors in some cases where it previously returned no errors at all. Instead, the RPC used to embed the error in the response struct via the `GitError` field. This has made us blind for actual issues which happen in production, and furthermore it trips Praefect's logic which decides whether we need to create repliction jobs or not. Rails has been adapted already in c7bcaadf193 (gitaly_client: Handle detailed errors for UserSquash, 2022-03-02), and the changes have been rolled out to production. While we required one follow-up fix to the new error codes we returned in 6c63998ad (operations: Fix wrong error code when UserSquash conflicts, 2022-03-11), the rollout has otherwise been successful. Remove the feature flag altogether and deprecated the `GitError` field, which isn't used anymore. Changelog: changed
2022-03-20Fix typo in documentation of UserCommitFilesRequestHeaderKartik
Signed-off-by: Kartik <kartikprajapati987@gmail.com>
2022-03-15Repository: allow opting for --mirror for CreateRepositoryFromURLGabriel Mazetto
Changelog: added
2022-03-10proto: Add structured error types for UserRebaseCofirmableJohn Cai
This commit introduces these changes by creating a new UserRebaseConfirmableError Protobuf message which contains all potential structured errors we want to return from the UserSquash RPC. Changelog: added
2022-03-07repository: Allow CreateRepository to take default_branchjc-create-repo-default-branchJohn Cai
In GitLab rails, there is code to ensure that the default branch on a new repository is set. This is currently done with an extra WriteRef call. This is done in a racy way, which causes problems with transaction voting. To fix this, we can simplify the logic altogether and avoid adding another roundtrip, add a parameter in CreateRepositoryRequest to pass a default_branch. Changelog: changed
2022-03-07proto: Deprecate PreReceiveError field in UserMergeBranchResponsePatrick Steinhardt
With e542a7d87 (operations: Implement rich errors for UserMergeBranch access checks, 2021-08-30) we have introduced the ode to return proper errors when access checks failed via gRPC's rich error model. The feature flag has been remove with a23b34894 (operations: Enable use of detailed errors for UserMergeBranch, 2022-02-16) , which means that we don't ever set the `PreReceiveError` field of the UserMergeBranchResponse message anymore. Deprecate the field such that we can eventually remove it. Changelog: deprecated
2022-03-07proto: Deprecate PreReceiveError field in UserMergeToRefResponsePatrick Steinhardt
The PreReceiveError field in the UserMergeToRefResponse isn't ever set because the RPC call doesn't in fact perform any access checks at all. Digging back through history this doesn't seem to be an oversight in the Go port, but was the case in the Ruby implementation already. While the initial implementation of UserMergeToRef in 8fbc337b8 (Allow merging to a ref without changing the target branch, 2019-01-25) still used to call hooks, this was explicitly changed with 19fdfa12a (Skip hooks for UserMergeToRef RPC, 2019-06-14) to not do so anymore. The field thus hasn't been set anymore for more than two years by now. Deprecate the PreReceiveError field so that we can eventually remove it. Changelog: deprecated
2022-03-02Mark RefTransactionService as handled by PraefectSami Hiltunen
This commit marks the RefTransactionService with the intercepted option to denote it is handled by Praefect. Such services do not need operation type annotations on the RPCs as they do not go through the proxy. This should have no behavioral changes and mostly just cleans up the code a bit.
2022-03-02Merge branch 'fj-add-load-content-param-to-wiki-find-page' into 'master'John Cai
Add skip_content param to wiki find page call See merge request gitlab-org/gitaly!4373
2022-03-02Add skip_content param to wiki find page callFrancisco Javier López
2022-03-01proto: Add structured error types for UserSquash RPCPatrick Steinhardt
We're about to introduce support for structured errors in the UserSquash RPC. We cannot roll out this change even with a feature flag though because some of our testing infrastructure will always test code with all feature flags enabled. We thus have to land the protobuf changes independently such that we can adjust downstream callers. This commit introduces these changes by creating a new UserSquashError Protobuf message which contains all potential structured errors we want to return from the UserSquash RPC. Changelog: added
2022-03-01operations: Remove deprecated `squash_id` from UserSquash RPCPatrick Steinhardt
Originally when UserSquash was still using worktrees to do its work, we used a squash ID which enabled us to reuse worktrees. We have since converted the RPC to do the rebase in-memory though, which allowed us to get rid of the use of worktrees and thus make the squash ID obsolete. It was thus deprecated in 112d74720 (operations: Deprecate `SquashId`, 2021-08-20), and callsites in Rails have been converted in fc5b05874f9 (gitaly_client: Drop use of squash ID, 2021-09-21). There aren't any other callsites left. Remove the `squash_id` altogether. Changelog: removed
2022-02-28Merge branch 'brodock/gitaly-clone-improvements' into 'master'Christian Couder
Enable CloneRepositoryFromURL to authenticate with custom token See merge request gitlab-org/gitaly!4239
2022-02-23Fix comments of GarbageCollectRequest used by gcblanet
Comments for prune field of GarbageCollectRequest indicates that if set true, dangling objects that are not modified in the last 24 hours would be dropped. But the time gap is 30 minutes actually. Commit ab6bc21a1140d0cab98855a7cd7fe81d166a6950 tuned the time gap from 24 hours to 30 minutes, but the proto comments are missed at that time. Signed-off-by: blanet <moweng.xx@alibaba-inc.com>
2022-02-22repository: Use optional auth token for cloningbrodock/gitaly-clone-improvementsGabriel Mazetto
This can be used by Geo to authenticate against a primary node Changelog: changed
2022-02-22repository-service: Add http_authorization_header optional parameterGabriel Mazetto
2022-02-17proto: Deprecate fine-grained repository maintenance RPCsPatrick Steinhardt
Historically we had and still have lots of fine-grained RPCs which perform repository maintenance in Gitaly. This meant that control of how repositories are packed does not reside in Gitaly though, and this is starting to become a bigger problem because we cannot easily iterate on how repositories should be maintained. We have thus recently extended the black-box-style maintenance RPC OptimizeRepository with the intent of making it the single source of truth for how repositories are packed. Deprecate the old fine-grained repository maintenance RPCs. They will be removed as soon as all callers have been migrated to OptimizeRepository, which will then allow us to improve the general repository maintenance strategy. Changelog: deprecated
2022-02-17proto: Document behaviour of the OptimizeRepository RPCPatrick Steinhardt
Document behaviour of the OptimizeRepository RPC call.
2022-02-17proto: Fix typo in documentation of PruneUnreachableObjectsPatrick Steinhardt
Fix typo in the documentation of the PruneUnreachableObjects RPC definition.
2022-02-14repository: Add new RPC to prune unreachable objectsPatrick Steinhardt
When rewriting the repository's history with the BFG Repo-Cleaner, then we potentially accumulate lots and lots of unreachable objects in the repository's object database. By default, we'd clean up those objects after two weeks, which is a rather long time to sit on such a huge number of objects. To fix this usecase we have thus gained a `prune` parameter in our GarbageCollect RPC call: if set, then we prune unreachable objects if they haven't been accessed during the last 30 mintues. The problem with this though is that GarbageCollect does a lot more than only pruning objects: it may end up packing objects or objects, writing commit-graphs, write bitmaps or some other things. All of these are things we want to control ourselves though, but we instead let git-gc(1) dictate how the repository is packed. We're thus about to deprecate all RPCs which directly influence how a repository is packed in favor of OptimizeRepository: this is our "black box" RPC that, from the viewpoint of the caller, does something with the repository to make it great again. And this is by design: callers should not control the way Gitaly handles repository maintenance. This highlights the need though for a new RPC call which _only_ prunes objects which have become unreachable to disentangle it from repository maintenance tasks. This commit thus introduces PruneUnreachableObjects, a new RPC which does exactly that: any unreachable loose object that hasn't been touched in the last 30 minutes is going to be pruned. Note that to make this work correctly, the caller has to do two RPC calls: the first RPC call to OptimizeRepository is required to unpack unreachable loose objects, and 30 minutes later they may prune these objects with a second call to PruneUnreachableObjects. This is no different from right now, even though it's hidden away and (naturally) used incorrectly by Rails: GarbageCollect would need to be called twice, first to explode unreachable objects into loose objects and then second with `prune=true` to prune them after half an hour. This is because Git will only ever consider loose objects for pruning, and the grace period is determined by inspecting its access time. So the way Rails does this is broken, and the new RPC call doesn't change that fact. This is a separate story though and nothing we can fix in Gitaly: we must retain the grace period to avoid repository corruption. Changelog: added
2022-01-28Merge branch 'security-add-host-option' into 'master'Mayra Cabrera
Add HTTP Host to all requests that use URLs See merge request gitlab-org/security/gitaly!46
2022-01-28Add HTTP Host to all requests that use URLsJames Fargher
2022-01-28operations: Deprecate the rebase IDPatrick Steinhardt
Back during the days when rebases were implemented via worktrees we tried to amortize costs of creating the worktrees by reusing them. To identify a worktree for reuse, callers passed a rebase ID identifying it, where no two concurrent rebase requests must have used the same ID. Nowadays though rebases are done in-memory without the use of worktrees, which is a lot more efficient, especially in big repositories. As a consequence, the rebase ID doesn't carry any value, and the RPC call `IsRebaseInProgress()` doesn't exist anymore either. It's thus useless, but we still require it to be passed. Stop validating the rebase ID and deprecate the field to phase out support for it. Changelog: deprecated
2022-01-25Merge branch 'ps-clock-check' into 'master'James Fargher
cmd/praefect: Check of the system clock synchronization Closes gitlab#342574 See merge request gitlab-org/gitaly!4225
2022-01-24Merge branch 'bwill/add-ssh-signature-type' into 'master'Patrick Steinhardt
feat: Detect SSH signed objects See merge request gitlab-org/gitaly!4255
2022-01-21proto: Add detailed errors when updating references failsPatrick Steinhardt
It is not possible for RPC clients to tell when RPCs have failed to update a reference. Add a new error detail type which represents such failures to prepare for passing down this information. Changelog: added
2022-01-20feat: Detect SSH signed objectsBrian Williams
Support for signing Git objects with SSH keys was added in Git v2.34.0. This change allows Gitaly to detect when an object was signed with an SSH key and indicates the signature type of that object as `SSH`. Changelog: added
2022-01-19cmd/praefect: Check of the system clock synchronizationPavlo Strokov
Because check of the authentication token depends on the time we need to make sure it is synced on the praefect machine and all gitaly machines that belong to the cluster. That is why a new check point is added to the 'check' sub-command of the praefect binary. The task should be run on the praefect node and doesn't require praefect to be up and running. It is possible to configure the URL of the NTP service and acceptable time offset via env variables NTP_HOST and DRIFT_THRESHOLD. The check has fatal severity because the cluster won't work correctly if auth checks fail continuously for each request. Closes: https://gitlab.com/gitlab-org/gitlab/-/issues/342574 Changelog: added