Age | Commit message (Collapse) | Author |
|
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.
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
The `AtomicFetchRemote` feature flag enables atomic transactions for the
`FetchRemote` RPC. Set this feature flag to be enabled by default.
|
|
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>
|
|
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>
|
|
|
|
Currently, we propagate only Git.SigningKey field; however,
it would be useful to have access to other configuration fields
as well
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
Removes the raw_operation field from the RawChange message. This field
was never populated by the RPC logic.
Changelog: deprecated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Removes the `force` field from the WriteRefRequest message as it was
never used in the RPC logic.
Changelog: deprecated
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|