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
AgeCommit message (Collapse)Author
2023-12-05git: Add GitattributesSupportReadingFromHead flagej-5720-add-flag-GitatrributesSupportsReadingFromHeadEric Ju
Git 2.43.0 starts supporting reading gitattributes from HEAD reference. This is a required feature for us to get rid of gitattributes-related RPCs. This `GitattributesSupportReadingFromHead` flag function check if current git version is above or equal 2.43.0.
2023-12-05Merge branch 'smh-extract-snapshot-path' into 'master'Sami Hiltunen
Restore snapshot's relative path in quarantined requests See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6550 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: James Fargher <jfargher@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: Sami Hiltunen <shiltunen@gitlab.com> Reviewed-by: Justin Tobler <jtobler@gitlab.com>
2023-12-05Merge branch 'jt/ff--atomic-fetch-remote-default' into 'master'karthik nayak
featureflag: Default enable `AtomicFetchRemote` See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6565 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Justin Tobler <jtobler@gitlab.com>
2023-12-05Merge branch 'kn-error-lint' into 'master'Patrick Steinhardt
errors: ensure errors work correctly with wrapped errors See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6555 Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Karthik Nayak <knayak@gitlab.com>
2023-12-05Merge branch 'jliu-rev-list-args-stdin' into 'master'Emily Chui
git: Pass rev-list arguments via stdin in the ObjectsSize RPC See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6561 Merged-by: Emily Chui <echui@gitlab.com> Approved-by: John Cai <jcai@gitlab.com> Approved-by: Emily Chui <echui@gitlab.com> Reviewed-by: Emily Chui <echui@gitlab.com> Co-authored-by: James Liu <jliu@gitlab.com>
2023-12-05featureflag: Default enable `AtomicFetchRemote`Justin Tobler
The `AtomicFetchRemote` feature flag enables atomic transactions for the `FetchRemote` RPC. Set this feature flag to be enabled by default.
2023-12-05Merge branch 'smh-tx-additional-repository' into 'master'Justin Tobler
Include alternate repo in the snapshot See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6559 Merged-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Sami Hiltunen <shiltunen@gitlab.com> Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
2023-12-05Merge branch 'id-change-committer-of-gitaly-commits' into 'master'Will Chandler
Specify GitLab as Committer for commits created by Gitaly See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6558 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: John Cai <jcai@gitlab.com> Reviewed-by: Igor Drozdov <idrozdov@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: John Cai <jcai@gitlab.com> Co-authored-by: Igor Drozdov <idrozdov@gitlab.com>
2023-12-04Specify GitLab as Committer for commits created by GitalyIgor Drozdov
2023-12-04Propagate the whole git config to Server and WriteCommitConfigIgor Drozdov
Currently, we propagate only Git.SigningKey field; however, it would be useful to have access to other configuration fields as well
2023-12-04Only snapshot valid Git directoriesSami Hiltunen
Transaction manager currently includes all requested relative paths in the snapshot. Typically this would be the relative path of the target repository. If the client fed it paths such as '@hashed', it would attempt snapshot the entire storage. If Gitaly controlled the directory structure, we could easily guard against this by only allowing leaf/project directories to be snapshotted. The paths are currently controlled by the client so we can't rely on this without possibly breaking some paths. Workaround this by checking whether the snapshotted directory is a git repository. If it isn't, the snapshotting will error out. This prevents using any of the higher level directories as the path to snapshot. The error equality assertion when beginning a transaction was changed to a an error.Is assertion. This avoids having to repeat the error annotations in tests which are not meaningful while still testing that the expected error is in the chain.
2023-12-04Include alternate repo in the snapshotSami Hiltunen
Some object pool related RPCs carry an alternate repository in the request they access. This repository needs to be included in the transaction's snapshot in order to ensure the RPC can access it as expected. This commit extracts the alternate repository from the request and includes it also in the transaction.
2023-12-04Take in a ClientConn in TestMiddleware subtestsSami Hiltunen
TestMiddleware subtests are currently taking in a RepositoryService client. We're soon going to be testing with ObjectPool service as well, so generalize the subtests to take in a ClientConn so its easier to use other services as well.
2023-12-04Support partitioning hintsSami Hiltunen
ObjectPool related RPCs often carry in the request the target repository and the alterante repository. Depending on the RPC the roles switch but these refer to the object pool and the member repository. Gitaly is currently assigning relative paths into partitions on first access. As it is, each repository goes into its own partition unless it has an alternate. If there is an alternate, the repository is assigned to the same partition. This ensures the pool and the member are assigned into the same partition so their operations are serialized. We currently don't support assigning a repository explicitly into the same partition as another repository. This will be needed in order to ensure that a repository that is being linked to a pool will be assigned to the same partition as the pool even before the link is made. Similarly, this can be used to ensure the repository created with CreateFork will be assigned to the same partition as the pool.
2023-12-01Merge branch 'jliu-docs-repository' into 'master'Will Chandler
proto: Update docs for repository.proto See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6553 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Approved-by: Emily Chui <echui@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Emily Chui <echui@gitlab.com> Co-authored-by: James Liu <jliu@gitlab.com>
2023-12-01Merge branch 'jc/add-bundleuri-metrics' into 'master'Toon Claes
bundleuri: Log bundle_uri See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6544 Merged-by: Toon Claes <toon@gitlab.com> Approved-by: Toon Claes <toon@gitlab.com> Co-authored-by: John Cai <jcai@gitlab.com>
2023-12-01Merge branch 'jliu-document-release-process' into 'master'Quang-Minh Nguyen
doc: Add overview of Gitaly release process See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6545 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Reviewed-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Reviewed-by: James Liu <jliu@gitlab.com> Reviewed-by: Emily Chui <echui@gitlab.com> Co-authored-by: James Liu <jliu@gitlab.com>
2023-12-01git: Pass rev-list arguments via stdinJames Liu
Modifies the ObjectsSize RPC to pass arguments to the `rev-list` command via stdin instead of the command line. This is now possible after the upgrade to Git v2.42 as pseudo-options are now supported when the `--stdin` mode is used. The RPC logic is restructured such that we create the command and wait for execution in separate steps so revisions can directly be written to stdin, without the use of an intermediary buffer. Additionally, a test has been added to ensure that revisions containing newlines are rejected by existing logic, since we now rely on newlines to delimit successive revisions and options.
2023-12-01proto: Add missing docs for PruneUnreachableObjects RPCJames Liu
2023-12-01proto: Add missing docs for RemoveRepository RPCJames Liu
2023-12-01proto: Add missing docs for GetCustomHooks RPCJames Liu
2023-12-01proto: Add missing docs for SetCustomHooks RPCJames Liu
2023-12-01proto: Add missing docs for CreateBundleFromRefListJames Liu
2023-12-01proto: Add missing docs to CreateBundle RPCJames Liu
2023-12-01proto: Add missing docs for FetchSourceBranch RPCJames Liu
2023-12-01proto: Add missing docs for FetchRemote RPCJames Liu
2023-12-01proto: Add missing docs for FetchBundle RPCJames Liu
2023-12-01proto: Add missing docs for SearchFilesByName RPCJames Liu
2023-12-01proto: Remove SearchFilesByContent unused fieldsJames Liu
Removes the `chunked_response` field in the request message and the `matches` field in the response message, as these were never used in the RPC logic. Fixes some typos in the test cases too. Changelog: deprecated
2023-12-01proto: Add missing docs for SearchFilesByContent RPCJames Liu
2023-12-01proto: Add missing docs for GetObjectDirectorySize RPCJames Liu
2023-12-01proto: Remove unused raw_operation fieldJames Liu
Removes the raw_operation field from the RawChange message. This field was never populated by the RPC logic. Changelog: deprecated
2023-12-01proto: Add missing docs for GetRawChanges RPCJames Liu
2023-12-01proto: Add missing docs for CreateRepositoryFromSnapshot RPCJames Liu
2023-12-01proto: Add missing docs for the GetSnapshot RPCJames Liu
2023-12-01proto: Add missing docs for CalculateChecksum RPCJames Liu
2023-12-01proto: Add missing docs for CreateRepositoryFromURL RPCJames Liu
2023-12-01proto: Add missing docs to FindMergeBase RPCJames Liu
2023-12-01proto: Remove unused `force` fieldJames Liu
Removes the `force` field from the WriteRefRequest message as it was never used in the RPC logic. Changelog: deprecated
2023-12-01proto: Add missing docs for WriteRef RPCJames Liu
2023-12-01doc: Add overview of Gitaly release processJames Liu
2023-11-30Merge remote-tracking branch 'dev/master'GitLab Release Tools Bot
2023-11-30Restore snapshot's relative path in quarantined requestsSami Hiltunen
Transactions in Gitaly operate against a snapshot of the repository to provide isolation. The snapshotting is done by copying the repository into a temporary directory and then rewriting the repository's relative path to point to the snapshot. The handler then operates on the rewritten request and targets the snapshot. Writes may trigger the pre-receive hook. The pre-receive hook calls Rails to verify whether the change is allowed or not. These checks in Rails perform various follow up RPCs to Gitaly to verify whatever they need to verify. These follow up calls are configured with the quarantine directory sent from Gitaly to Rails. The quarantine paths are relative paths from the repository to the quarantine directory. Before transactions, these quarantine paths were relative to the actual repository. As transactions operate against the snapshot repository, the quarantine paths are also relative to the snapshot repository. For the quarantine paths to apply correctly, the follow up requests from the access checks must also target the snapshot repository. Rails has previously been updated to send the snapshot's relative path in a header to Gitaly. This commit changes Gitaly to extract the relative path from the header and use that in the request if the request has a quarantine configured. This ensures the quarantine path is correctly applied against the snapshot repository. Tests exercising quarantining logic were updated to set the relative path metadata key as Rails would.
2023-11-30golangci-lint: Enable the `errorlint` lint checkKarthik Nayak
The `errorlint` lint check is used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. With the fixes in the previous commits, we can finally enable this linter.
2023-11-30golangci: Sort the linters alphabeticallyKarthik Nayak
2023-11-30errors: Add nolint directive while printing error typeKarthik Nayak
In the testhelper package, we print the type of the error. This is flaged by lint checkers. To the existing `nolint:gitaly-linters` directive, let's add 'errorlint'. Which is to be introduced in the following commit.
2023-11-30errors: Fix format directive for two errorsKarthik Nayak
There are 2 instances in our code base where we have two errors and want to merge them. While the best fix would be to use `errors.Join()`, for now, let's just fix the type so that the linter doesn't barf.
2023-11-30errors: Use `errors.As()` instead of switch type assertionsKarthik Nayak
In few places of our code base, we have code like: switch terr := err.(type) { case nil: if err == nil { return vs case ValidationErrors: for _, err := range terr { } This doesn't work with wrapped errors. So let's use `errors.As()` instead. This makes the code a little messier but is compatible with wrapped errors. We skip making changes in structerr package, since there we explicitly want to unwrap the layers to extract the metadata.
2023-11-30errors: Use `errors.As()` for type assertionKarthik Nayak
Currently for type assertion of errors, we use the `err.(<Interface>)` form. This works, but is not compatible with wrapped errors. So let's use `errors.As()` instead.
2023-11-30errors: Use `errors.Is()` instead of switch on errorsKarthik Nayak
Currently in many places of our codebase, we have: switch err { case ErrMissingLeaseFile: c.errTotal.WithLabelValues("ErrMissingLeaseFile").Inc() case ErrPendingExists: c.errTotal.WithLabelValues("ErrPendingExists").Inc() } while this works, its not compatible with wrapped errors. So let's fix this by using `errors.Is()` instead.