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-03-30smarthttp: Fix test race where response buffer may not be filledpks-smarthttp-refactor-flaky-gitconfig-testPatrick Steinhardt
We have observed a racy test in production where fetching a hidden ref via `PostUploadPack` isn't failing in the way we expect it to. While the error code is there and the RPC call itself has failed, the response buffer we see is completely empty. This race can easily be caused by our testing infrastructure though: we use `makePostUploadPackWithSidechannelRequest()` to set up a sidechannel and then copy the sidechannel data via a separate Goroutine. In case we see an error though while handling the sidechannel (which is the case: we expect to fail fetching the hidden ref), we don't synchronize with the Goroutine copying the response. Fix this race by properly synchronizing the Goroutine via a wait group.
2022-03-29smarthttp: Refactor flaky test which checks that GitConfig is appliedPatrick Steinhardt
One of our tests is verifying that the `GitConfigOptions` which can be passed to us via the `PostUploadPackRequest` is applied as expected. This is done by creating a reference and then injecting config which tells git-upload-pack(1) to hide this reference. If this config is applied as expected, then we should see that the server refuses to give us the object pointed to by the hidden reference. Refactor this test to be less reliant on the repository state, which is kind of confusing. The object pointed to by the hidden reference should in fact already be pointed to by another visible reference, which is quite puzzling. Furthermore, we also hard-code how many objects we expect to receive, which is one more thing that depends on this specific repository. Convert the test to use an empty repository instead and create two commits ad-hoc.
2022-03-29Merge branch 'jv-sidechannel-window' into 'master'Sami Hiltunen
sidechannel: use default yamux max window size Closes #4132 See merge request gitlab-org/gitaly!4439
2022-03-29Merge branch 'pks-sidechannel-migrate-to-runtime-dir' into 'master'Toon Claes
sidechannel: Convert to use runtime directory to store sockets See merge request gitlab-org/gitaly!4428
2022-03-29Merge branch 'pks-ci-bundled-git' into 'master'James Fargher
ci: Convert jobs to test with bundled Git only by default See merge request gitlab-org/gitaly!4391
2022-03-28sidechannel: use default yamux max window sizeJacob Vosmaer
This changes the sidechannel client to not create unnecessarily large buffers for received data. The previous behavior was to lazily buffer up to 16MB of response data, which can lead to bloat in the client. Changelog: other
2022-03-28Merge branch 'pks-git-v2351-default' into 'master'Toon Claes
git: Enable bundled Git v2.35.1.gl1 by default See merge request gitlab-org/gitaly!4437
2022-03-28Makefile: Drop dependency on bundled Git in our non-bundled testsPatrick Steinhardt
Our non-bundled test targets currently depend on bundled Git. This was done such that we were able to verify the bundled Git feature flag, which toggled between both bundled Git and distributed Git. Now that this feature flag is gone it doesn't make any sense to keep testing with both Git execution environments installed.
2022-03-28ci: Add job to exercise minimum required Git versionPatrick Steinhardt
With the conversion of our CI jobs to use bundled Git by default we're not testing the minimum required Git version anymore. Add a new job which tests that we're still compatible with this version to assert that we're not starting to use new Git features which aren't available in this version.
2022-03-28ci: Convert jobs to test bundled Git by defaultPatrick Steinhardt
We only have a single CI job right now which tests bundled Git. This Git execution environment has become our default though, and consequentially we should also have most of our CI jobs use it. Convert jobs to use bundled Git by default.
2022-03-28ci: Invalidate caches when CI configuration changesPatrick Steinhardt
Whenever the CI configuration changes chances are quite high that the caches will become stale. Let's thus invalidate them in case the CI configuration changes.
2022-03-28support: Adapt test-boot script to support bundled GitPatrick Steinhardt
The test-boot script doesn't currently support bundled Git, so it will only be able to bootstrap a server when a Git distribution is available. Adapt the script to also support bundled Git so that we can use it in contexts where it is the only Git execution environment available.
2022-03-28git: Enable bundled Git v2.35.1.gl1 by defaultPatrick Steinhardt
With b547b368c (git: Support bundled Git v2.35.1.gl1, 2022-02-22) we have introduced support fur bundled Git v2.35.1.gl1. The flag was subsequently rolled out on 2022-03-23. While there had been initial issues with repositories which had preexisting corrupted references, which were uncovered by this upgrade, the rollout went along smoothly otherwise. Let's enable this new Git version by default. Note that this will cause us to also use the new Git version in background jobs, which aren't covered right now because we don't support feature flags in there. Changelog: changed
2022-03-28ssh: Inject feature flags via the test contextPatrick Steinhardt
When setting up a push for our tests, we also have the ability to inject feature flags by setting the `featureFlags` field. This has a major downside though: the feature flags injected via the context and the feature flags executed at a later point when actually running the command may easily drift apart. This inconsistency is something that may break assumptions on our side though, where some parts may now evaluate a flag to `true` while others evaluate it to `false`. Fix this inconsistency by instead accepting feature flags via a context. This both simplifies the code and fixes such an upcoming incompatibility when we're about to default-enable Git v2.35.1.gl1.
2022-03-28ssh: Refactor tests to not create worktreePatrick Steinhardt
Our SSH tests need to set up a repository with some new objects so that it can verify that these objects end up on the remote side after the push. To create those objects, we currently use a worktree and then execute git-commit(1). This usage pattern is outdated though: we have a `gittest.WriteCommit()` helper which does not require a worktree. Refactor tests to use this new helper so that we can get rid of using a worktree.
2022-03-24Merge branch 'pks-ff-remove-bundled-git' into 'master'Toon Claes
git: Remove feature flag for bundled Git Closes #4064 See merge request gitlab-org/gitaly!4429
2022-03-24Update changelog for 14.7.6GitLab Release Tools Bot
[ci skip]
2022-03-24Merge branch 'pks-makefile-spring-cleanup' into 'master'Toon Claes
Makefile: Spring cleanup See merge request gitlab-org/gitaly!4409
2022-03-24Merge branch 'fix-cgroups-stats-collection' into 'master'John Cai
cgroups: Allow stats to be collected in absence of memsw.* entries See merge request gitlab-org/gitaly!4431
2022-03-24Makefile: Remove comment stating that `coverage` doesn't failPatrick Steinhardt
The `coverage` Makefile target used to not fail in the past. Nowadays it does though because it executes `run_go_tests` on its own.
2022-03-24Makefile: Fix name of `GOTESTSUM_VERSION` variablePatrick Steinhardt
Fix name of the `GOTESTSUM_VERSION` variable, which was accidentally called `GOSUMTEST_VERSION`.
2022-03-24Makefile: Remove unused `smoke-test` targetPatrick Steinhardt
Remove the unused `smoke-test` target. It's used in none of our projects, and it only tests things already covered by other targets.
2022-03-24ci: Increase test coverage of PgBouncer jobPatrick Steinhardt
The PgBouncer CI job is currently only executing the `test-postgres` target, which only exercises a subset of our test suite. It's much more sensible thoguh to instead execute `test-with-praefect` so that we can assert that a "real" Praefect proxy works alright in combination with PgBouncer. Do this conversion and remove the now-unused `test-postgres` target. Convert the job to run tests as unprivileged user so that we don't ignore permissions, or otherwise some of our tests would break.
2022-03-24Makefile: Move together Protobuf-related targetsPatrick Steinhardt
Move together Protobuf-related targets.
2022-03-24Makefile: Simplify `no-proto-target` to not write temporary filePatrick Steinhardt
Simplify the `no-proto-target` to not write a temporary file, but instead use the `--exit-code` flag of git-diff(1). Like this, any changes that exist will be printed to stdout directly.
2022-03-24Makefile: Upgrade go-licenses to v1.0.0Patrick Steinhardt
Upgrade go-licenses to v1.0.0. Most importantly, this release contains a fix to the way project sources are copied into the target directory so that we don't end up with files and directories which cannot be modified [1]. The workaround we have in our codebase which fixes the permissions can be removed as a consequence. Note that this causes us to pick up an additional file that's part of our own sources as licensed file because it's a test verifying that licenses can be parsed alright, and thus it contains a license body itself. It's known though that go-licenses behaves weird already though: it copies the complete sourcecode of projects into the target directory in case it detects that the license requires it. So adding one more weird edge case to our NOTICE file doesn't really matter. Together with the fact that we can remove the workaround we previously had this seems like an acceptable tradeoff. [1]: https://github.com/google/go-licenses/issues/11
2022-03-24Makefile: Run goimports only oncePatrick Steinhardt
As part of the `format` Makefile target we also run `goimports` to automatically fix up missing or superfluous imports. Because of the way `goimports` adds these imports, the end result may not conform to the code style as dictated by `gofumpt`. To fix any formatting differences, we call `goimports` twice: once before, and once after `gofumpt`. This doesn't really make a lot of sense though: executing it once before the formatter runs should be sufficient. For it to not be sufficient the formatter would have to remove imports again, and this is something I'd claim doesn't happen. Remove the second call to `goimports` to speed up the `format` target.
2022-03-24Makefile: Upgrade gofumpt to v0.3.1Patrick Steinhardt
Upgrade gofumpt to v0.3.1. Besides a very small number of new rules, the most important benefit is that the new version parallelizes formatting of files. It is thus much faster, also for our codebase: $ hyperfine --warmup=1 'make format' 'make format GOFUMPT_VERSION=0.3.0' Benchmark #1: make format Time (mean ± σ): 1.238 s ± 0.060 s [User: 1.337 s, System: 0.084 s] Range (min … max): 1.125 s … 1.312 s 10 runs Benchmark #2: make format GOFUMPT_VERSION=0.3.0 Time (mean ± σ): 239.5 ms ± 26.0 ms [User: 1.804 s, System: 0.109 s] Range (min … max): 180.6 ms … 284.7 ms 14 runs Summary 'make format GOFUMPT_VERSION=0.3.0' ran 5.17 ± 0.61 times faster than 'make format' Reformat our code with the new version.
2022-03-24linting: Remove unused linting exemptionPatrick Steinhardt
Remove an unused golangci-lint linting exemption.
2022-03-24lint: Move linting exceptions for calling kill inlinePatrick Steinhardt
There's several locations where we don't verify that the `Kill()` syscall succeeded. Move the linting exceptions we have in our golangci-lint configuration inline to clearly indicate that this is something we may want to fix in the future.
2022-03-24nodes: Silence warnings about ignored errors for `checkNodes()`Patrick Steinhardt
Both the local and SQL electors don't check errors returned by `checkNodes()`. While we could convert all sites to properly do this, it doesn't really feel worth it: both electors only exist due to legacy reasons and should not be used in production systems at all. Ignore most of those errors inline so that we can remove the excemptions from golangci-lint's config file.
2022-03-24cmd/gitaly-wrapper: Log warning when supervised command failsPatrick Steinhardt
We currently ignore any errors when waiting for the supervised command fails. Log the error so that we at least have a chance to see that something may have gone wrong.
2022-03-24Makefile: Update golangci-lint to v1.44.2Patrick Steinhardt
Update golangci-lint to v1.44.2, which currently is the latest available release.
2022-03-24cgroups: Allow stats to be collected in absence of memsw.* entriesAhmad Sherif
Otherwise, we get errors such as `open /sys/fs/cgroup/memory/gitaly/gitaly-1/memory.memsw.usage_in_bytes: no such file or directory`. Changelog: fixed
2022-03-24Merge branch 'jv-get-archive-request-hash' into 'master'Toon Claes
GetArchive: log request hash See merge request gitlab-org/gitaly!4425
2022-03-23Merge branch 'jc-add-cgroup-cmd-logging' into 'master'John Cai
command: Log cgroup path See merge request gitlab-org/gitaly!4420
2022-03-23Merge branch 'jc-rebase-cofirmable-structured-errors' into 'master'Toon Claes
repository: Structured errors for UserRebaseConfirmable See merge request gitlab-org/gitaly!4419
2022-03-23command: Log cgroup pathJohn Cai
We'd like to be able to tell if a command was run in a cgroup based on the log entry. This change adds a field in the Command struct so whenever the Cmd finishes, a cgroup field gets logged. Changelog: added
2022-03-23Update changelog for 14.9.1GitLab Release Tools Bot
[ci skip]
2022-03-23sidechannel: Convert to use runtime directory to store socketspks-sidechannel-migrate-to-runtime-dirPatrick Steinhardt
The sidechannel code is used to create sidechannels that circumvent gRPC for efficiency's sake. This socket is currently created in the system's temporary directory as returned by `os.MkdirTemp()`. This has the very real downside that it easily leaks created files and directories in case we have a logic bug anywhere. We have recently introduced a new runtime directory that can help us in this situation: the runtime directory is created once at a central place and will be cleaned up when shutting down Gitaly. Consequentially, even if we leaked and sidechannel files, we'd still remove them on shutdown. And even if we didn't: the runtime directory is designed so that we can check whether it's used because it has the current process's PID as part of its component. So if a runtime directory exists whose PID doesn't refer to any existing process it's safe to remove. While we don't have any such logic yet, it can easily be added at a later point and have all code which started to use the runtime directory benefit at the same time. Migrate the sidechannel code to create sockets in a subdirectory within the runtime directory called "sidechannel.d" if the runtime directory is set via the hooks payload. Changelog: changed
2022-03-23git: Remove feature flag for bundled GitPatrick Steinhardt
Since 073727abd (git: Add a feature flag to toggle between bundled and external Git, 2022-01-13) we have now carried a feature flag that allowed us to ease into the deployment of bundled Git in production. With this new Git execution environment, Gitaly doesn't need a full Git distribution anymore but can instead have multiple sets of bundled Git binaries installed into its own binary directory from which it can bootstrap a complete Git environment. This allows us to use feature flagged rollouts of new Git versions in production and fixes issues with zero-downtime upgrades. Bundled Git has been rolled out for a full month by now and is default enabled since 52625870d (git: Enable use of bundled Git by default, 2022-02-28). Let's consider it stable and remove the feature flag altogether. In the worst case, users can still disable bundled Git via the Gitaly configuration anyway. Changelog: changed
2022-03-23git: Fix bundled Git test relying on state of feature flagPatrick Steinhardt
One of our tests for bundled Git verifies that the command factory is setting up the execution environment as expected. This test implicitly relies on the state of feature flags though because it assumes that all bundled Git constructors are usable. This worked alright by pure chance: the feature flag for this bundled Git constructor is always true because we use `math.Rand()` to set the flag's value, which isn't ever properly seeded. Fix this issue by hard-coding the feature flag value to `true` so that the test doesn't break when the randomly injected value changes.
2022-03-22repository: Structured errors for UserRebaseConfirmableJohn Cai
Currently, UserRebaseConfirmable will return gRPC OK even when there is an error during rebase or if there is an error during PreReceive when it calls the GitLab API for an access check. This change modifies the error handling to return a detailed gRPC structured error in either of these failure modes. Changelog: changed
2022-03-22Merge branch 'pks-gitaly-runtime-dir' into 'master'Toon Claes
gitaly/config: Introduce runtime directory configuration Closes #4113 See merge request gitlab-org/gitaly!4415
2022-03-22Merge branch 'pks-housekeeping-prune-heuristics-mtime' into 'master'Patrick Steinhardt
housekeeping: Skip prune if there are no old objects Closes #4121 See merge request gitlab-org/gitaly!4423
2022-03-22housekeeping: Skip prune if there are no old objectsPatrick Steinhardt
The `OptimizeRepository()` RPC heuristically executes git-prune(1). The heuristic we currently use counts the number of loose objects which exist after having repacked the repository, and, if they exceed a given threshold, we'll try to remove them. This also causes us to try and prune objects though in case there are unreachable, but recent objects. But because unreachable objects don't get packed, and because we only prune objects older than two weeks, this will in many cases cause us to execute git-prune(1) without any need. Improve the heuristic to only prune objects in case there are loose objects which have an mtime older than two weeks. This should in the general case avoid useless prunes, but still detect the case where there is work to be done. Changelog: performance
2022-03-21Merge branch 'pks-user-squash-always-use-structured-errors' into 'master'John Cai
operations: Always use structured errors for UserSquash Closes #4099 See merge request gitlab-org/gitaly!4424
2022-03-21GetArchive: log request hashJacob Vosmaer
This will allow us to determine in the future if it is worth adding a cache for GetArchive.
2022-03-21git: Migrate Git exec path to use runtime directoryPatrick Steinhardt
Migrate the temporary Git exec path set up by the Git command factory to be created in the runtime directory. Changelog: changed
2022-03-21git: Migrate hook directory to use runtime directoryPatrick Steinhardt
Migrate the temporary hook directories set up by the Git command factory to be created in the runtime directory. Changelog: changed