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
2022-08-01ssh: Fix test overriding Git environmentuse-ubi-imagePatrick Steinhardt
Our tests that exercise pushing objects to SSHReceivePack are using the helper funciton `sshPushCommand()` to construct a git-push(1) process. As part of this setup we also inject various environment variables that are required for the `gitaly-ssh` auxiliary binary so that it knows how to connect back to the Gitaly server. The setup of those environment variables is accidentally overriding the complete environment that was returned by `gittest.NewCommand()` though, which also means that any setup done by the Git command factory is lost. Part of this setup also includes the `GIT_EXEC_PATH` environment variable that tells Git where to find its binaries. This essentially means that when running tests with bundled Git, we have by accident been picking up the wrong Git executables. While this has worked just fine until now, this breaks with the introduction of FIPS-enabled UBI images which don't have Git installed in `/usr`, but in `/usr/local`. As a consequence, we fail to find the correct Git executable and thus fail the test. Fix this bug by appending to the environment instead of overriding it completely.
2022-08-01Use custom docker image for FIPS testsBalasankar "Balu" C
Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
2022-07-29Merge branch 'smh-clean-build-cache' into 'master'Will Chandler
Clean up go build cache if it exceeds a threshold Closes #4392 See merge request gitlab-org/gitaly!4765
2022-07-29Merge branch 'pks-ssh-cancelled-packfile-negotiation' into 'master'Patrick Steinhardt
ssh: Handle timeout waiting on packfile negotiation with proper errors See merge request gitlab-org/gitaly!4761
2022-07-29ssh: Handle timeout waiting on packfile negotiation with proper errorsPatrick Steinhardt
Before the introduction of 3c6bc2db7 (Limit the negotiation phase for certain Gitaly RPCs, 2019-10-15), SSHUploadPack and SSHUploadArchive had been vulnerable to a TOCTOU race: the client could open a session to the server and keep it up almost indefinitely without starting the packfile negotiation yet, so that access checks have already been performed but the client can still ask for an arbitrary set of objects to be sent to it. So even if the client's access got rejected meanwhile, it could still ask for arbitrary objects after the fact by starting the packfile negotiation at whatever point the client wants to. This TOCTOU race has been plugged by listening in on the negotiation and putting a limit on how long that phase may span. The underlying thought is that it's fine to keep the actual packfile streaming open for an arbitrary amount of time because at that point the objects have already been negotiated anyway. We have observed some flakiness in this area though in our CI pipelines, where the timeout would sometimes return a `codes.Canceled` instead of our currently-assumed `codes.Internal` error. But taking a deeper look it is actually surprising that we'd return `codes.Internal` in the first place: it's a well-defined error case and we should provide proper information to the client to distinguish the case where we timed out waiting for the packfile negotiation to complete. Instead, we just return an error that is indistinguishable from other errors. Fix this shortcoming by properly handling the case where we cancel the context ourselves due to the packfile negotiation timing out. We now return a proper error message as well as an error code to the client that makes it easy to see what's happening. Chances are that this will also fix the flakiness in our CI, but it's hard to tell. Changelog: fixed
2022-07-29ssh: Verify errors in testcases exercising timeout logicPatrick Steinhardt
We have two tests for SSHUploadPack and SSHUploadArchive that verify that we correctly handle timeouts when waiting for the packfile negotiation to conclude. These tests only verify the error code though and don't care at all about the error message. We have seen some flakiness here though where the error code didn't match the expected error code, but because we don't have any information on the error message it's hard to tell why exactly these tests flake. Refactor them to instead assert the complete gRPC error to give us more information the next time these tests are flaky. This also surfaces a missing feature flag test.
2022-07-29ssh: Simplify handling of `GlRepository()` for logging purposesPatrick Steinhardt
When receiving an SSHUploadPack request we log some information included in the request. Part of that information is the information about the GitLab repository the request has been created for, which we laboriously extract from the request while paying attention to not dereference any `nil` pointers. Simplify the code to insetad use the Protobuf's getter functions, which already know to handle `nil` pointers for us.
2022-07-29ssh: Refactor some tests to generate test data at runtimePatrick Steinhardt
Refactor some tests for SSHUploadPack to generate test data at runtime instead of using the seed repository. This makes the test setup more obvious and makes those tests compatible with SHA256. Last but not least, it significantly speeds up the test from around 2.85s to 1.20s on my own machine given that we have to handle a whole lot less data.
2022-07-29helper: Add error functions for `DeadlineExceeded` codesPatrick Steinhardt
Add error functions for the gRPC code `DeadlineExceeded`.
2022-07-28Merge branch 'pks-grpc-proxy-test-refactorings' into 'master'John Cai
proxy: Refactor tests to share less state and use `grpc_testing` test service See merge request gitlab-org/gitaly!4756
2022-07-28Merge remote-tracking branch 'dev/master'GitLab Release Tools Bot
2022-07-28Clean up go build cache if it exceeds a thresholdsmh-clean-build-cacheSami Hiltunen
Our build process never cleans up the go build cache and neither does go. Users are expected to run `go clean --cache` occassionally to clean up old files. This has so far been generally fine, given each build didn't bloat the cache too much. With the introduction of packed binaries in 861730ac, the build cache grows at a much higher rate due to the embedded binaries. This has resulted the CI also running out of space. This commit adds a configurable threshold for cleaning up Go's build cache and sets the default at 5 GB. If the build cache is larger than 5GB at the beginning of the build, the build cache is automatically cleaned.
2022-07-28Merge branch 'jt-update-gitaly-onboarding-template' into 'master'Sami Hiltunen
Template: Update Gitaly onboarding See merge request gitlab-org/gitaly!4738
2022-07-28Update changelog for 15.0.5GitLab Release Tools Bot
[ci skip]
2022-07-28Update changelog for 15.1.4GitLab Release Tools Bot
[ci skip]
2022-07-28Update changelog for 15.2.1GitLab Release Tools Bot
[ci skip]
2022-07-27Template: Update Gitaly onboardingjt-update-gitaly-onboarding-templateJustin Tobler
Added information and references to the Gitaly onboarding issue.
2022-07-27Merge branch 'sh-bump-google-protobuf-ruby' into 'master'Sami Hiltunen
Update google-protobuf Ruby gem to v3.21.3 See merge request gitlab-org/gitaly!4762
2022-07-27Merge branch 'sh-clean-build' into 'master'Sami Hiltunen
Support `make clean-build` to only clean the build directory See merge request gitlab-org/gitaly!4744
2022-07-27Merge branch 'wc-remove-db-only' into 'master'Sami Hiltunen
praefect: Add -db-only flag to remove repository Closes #4279 See merge request gitlab-org/gitaly!4715
2022-07-27Merge branch 'pks-objectpool-remove-optimize-repository-ff' into 'master'Will Chandler
objectpool: Remove feature flag guarding heuristical repo maintenance Closes #4342 See merge request gitlab-org/gitaly!4757
2022-07-27Update VERSION filesv15.3.0-rc1GitLab Release Tools Bot
[ci skip]
2022-07-27Merge branch 'pks-user-create-tag-preparatory-refactorings' into 'master'Patrick Steinhardt
operations: Preparatory refactorings for UserCreateTag See merge request gitlab-org/gitaly!4740
2022-07-27Merge branch 'pks-user-create-tag-error-proto' into 'master'Sami Hiltunen
proto: Introduce structured UserCreateTagError See merge request gitlab-org/gitaly!4741
2022-07-27Merge branch 'smh-remove-legacy-go-mod' into 'master'Sami Hiltunen
Remove legacy go.mod and go.sum files from _build directory Closes #4381 See merge request gitlab-org/gitaly!4758
2022-07-27Update google-protobuf Ruby gem to v3.21.3Stan Hu
This not only addresses CVE-2021-22569, but it also pulls in all the big endian fixes made towards supporting s390x (https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6435). This also mirrors the update in GitLab Rails: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93122 Changelog: changed
2022-07-27Merge branch 'sh-bump-rails-gems-6.1.6.1' into 'master'Stan Hu
Bump all Rails-related gems to v6.1.6.1 See merge request gitlab-org/gitaly!4759
2022-07-27Merge branch 'pks-gittest-hash-clean' into 'master'Patrick Steinhardt
gittest: Refactorings to make the package hash-clean See merge request gitlab-org/gitaly!4734
2022-07-27operations: Refactor tests for UserCreateTagPatrick Steinhardt
The tests we have for UserCreateTag leave some things to be desired. First, they depend on object hashes quite a lot and thus make it hard to eventually transition the tests to support SHA256. Second, many of the tests in fact change the underlying repository and thus lean on fragile cleanup logic after every subtest to bring back the repository into a well-defined state again. And third there are many small nits about how things don't match our best practices around naming variables and similar things. Refactor the tests to address those issues. Most importantly, we now use `gittest.CreateRepository()` everywhere and create required test data at test execution time so that we don't have to depend on object hashes anymore.
2022-07-27operations: Validate tag name more thoroughly in UserCreateTagPatrick Steinhardt
While we validate that the tag name doesn't contain any spaces in UserCreateTag, that's as far as our validation goes. This is missing a lot of different cases though where the tag name is invalidly formatted like for example when it contains newlines. As a result, we don't fail early when the tag name is invalid but will fail when git-update-ref(1) notices the invalid format. While not a serious error given that we do eventually detect this, the error message we return in that case is still one of the old errors that we have added to stay compatible with the exact errors returned by the old Ruby implementation. Furthermore, we retun an `Unknown` error code in that case instead of an `InvalidArgument`. Fix this by using `git.ValidateRevision()` instead, which catches a lot more invalid reference names than just a contained space. Changelog: fixed
2022-07-27operations: Refactor Ruby-compatible argument validationPatrick Steinhardt
The validation we have for arguments passed to the UserCreateTag RPC is still carrying around quite some baggage from the old Ruby days. While this made sense back in the day to reduce friction when migrating the implementation of this RPC from Ruby to Go, this does feel somewhat dated nowadays. Refactor validation of arguments to return Go-style error messagess and wrap the error in an `InvalidArgument` error code.
2022-07-27operations: Rename tag-related tests to match modern best practicesPatrick Steinhardt
Rename tag-related tests to match modern-best practices.
2022-07-27proto: Improve documentation for UserCreateTagsPatrick Steinhardt
Improve the documentation for our Protobuf definitions of UserCreateTags.
2022-07-27proxy: Remove now-unused test service definitionspks-grpc-proxy-test-refactoringsPatrick Steinhardt
The test service definitions used by the grpc-proxy package aren't used by anything anymore given that we have now converted all tests to instead use the `grpc_testing` test package. Remove the test definitions.
2022-07-27client: Convert to use `grpc_testing` test servicePatrick Steinhardt
Convert the client's dialling tests to use the `grpc_testing` test service instead of the `grpc_proxy` one.
2022-07-27proxy: Parallelize testsPatrick Steinhardt
Now that we have duplicated a lot of sharedstate in our proxy tests they have become a bit slower given that they need to setup their testing state anew. Let's cushion the impact of this by parallelizing tests.
2022-07-27proxy: Convert StreamHandlers tests to be table-drivenPatrick Steinhardt
Convert the StreamHandlers tests to be table-driven and convert them to use the `grpc_testing` test service.
2022-07-27proxy: Refactor handler tests to use `grpc_testing` test servicePatrick Steinhardt
Refactor the tests that are using the `assertingService` to instead use the same testing infrastructure as our peeker-tests via the pinger backend. This allows us more flexibility in writing tests and avoids some global state as every test can easily put in its own RPC stubs.
2022-07-27proxy: Deduplicate proxy setup code used in testsPatrick Steinhardt
We have multiple functions that set up the proxy in our tests. Refactor the code to deduplicate this logic.
2022-07-27proxy: Get rid of shared state via test suitePatrick Steinhardt
The extended proxy handler tests use a testing suite to group together a set of tests that have similar setup. While this helps reduce the time used to execute those tests, the shared state really makes it hard to understand what exactly is going on in those tests. Furthermore, it makes it harder than necessary to iterate on the implementation of a specific test without also impacting the other tests. Split out the test suite's setup into a `setupProxy()` function and convert the tests into standalone tests that don't use a shared test suite anymore.
2022-07-27proxy: Convert peeker tests to use `grpc_testing` test servicePatrick Steinhardt
We have defined our own gRPC test service in order to assert behaviour with various kinds of RPCs. This isn't really necessary though given that the grpc-go package already provides a test service that can be used exactly for these purposes. Convert the peeker tests to use the `grpc_testing.TestService`.
2022-07-27proxy: Modernize test style and more thoroughly verify assumptionsPatrick Steinhardt
Modernize the test style of the peeker tests to use modern helpers like `testhelper.ProtoEqual()` more extensively in order to more thoroughly assert our assumptions. Also, avoid the usage of abbreviated variable names in order to not leave the reader deciphering them all the time.
2022-07-27proxy: Use `t.Cleanup()` to simplify test setupsPatrick Steinhardt
Simplify the setup of tests by using `t.Cleanup()` to finalize resources instead of passing a cleanup function to the caller.
2022-07-27proxy: Move `TestMain()` into test helper filePatrick Steinhardt
Move the `TestMain()` function into our test helper file and rename the file to `testhelper_test.go` like it is customary in our codebase.
2022-07-27Merge branch 'docs-max-queue-size-gitaly' into 'master'John Cai
Clarify max_queue_size is per RPC, not project See merge request gitlab-org/gitaly!4753
2022-07-26Bump all Rails-related gems to v6.1.6.1sh-bump-rails-gems-6.1.6.1Stan Hu
All versions should have been bumped in unison since they are released at the same time, and this change mirrors the GitLab Rails changes in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92400. Changelog: changed
2022-07-26Support `make clean-build` to only clean the build directorysh-clean-buildStan Hu
A `make clean` wipes all Ruby gems, but sometimes we just want to clean up the `_build` dir. Relates to https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93119
2022-07-26Remove legacy go.mod and go.sum files from _build directorysmh-remove-legacy-go-modSami Hiltunen
The build process left a go.mod and go.sum file in the _build directory in the past. This causes problems these days when attempting to embed the auxiliary binaries into Gitaly binary as they are considered to be in a different module due to this. Remove the legacy files prior to building Gitaly.
2022-07-26Merge branch 'jc-remove-user-cherry-pick-ff' into 'master'Will Chandler
operations: Remove CherryPickStructuredErrors feature flag See merge request gitlab-org/gitaly!4747
2022-07-26objectpool: Remove feature flag guarding heuristical repo maintenancepks-objectpool-remove-optimize-repository-ffPatrick Steinhardt
In 410295810 (objectpool: Switch to use OptimizeRepository for pool repos, 2022-07-12) we have migrated maintenance of object pools in `FetchIntoObjectPool()` to use the same repository maintenance as we use for normal repositories. This deduplicates the logic, makes sure we keep more data structures up to date in object pools and also unifies nightly and normal maintenance for pool repositories. We have rolled out this feautre flag to production without any issues observed so far. So let's remove the feature flag and unconditionally enable heuristical repository maintenance for object pools. Changelog: changed