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
2021-09-20golangci: Disallow usage of "io/ioutil" packagePatrick Steinhardt
The "io/ioutil" package has been deprecated in Go 1.16 and thus shouldn't be used in our codebase anymore. Disallow its usage by adding the "depguard" linter with a single entry for this specific package. Note that we still use the package in some places where we used to rely on `ioutil.ReadDir()`'s old behaviour of stat'ting all directory entries. Conversion of these is not part of this patch series given that it would be a change in behaviour compared to all the other changes which aren't. Those sites are thus annotated with `nolint` directives.
2021-09-20global: Replace deprecated usage of `ioutil.TempFile()`Patrick Steinhardt
With Go 1.16, the ioutil package was deprecated. Replace our usage of `ioutil.TempFile()` with `os.CreateTemp()` to adapt accordingly.
2021-09-20global: Replace deprecated usage of `ioutil.ReadFile()`Patrick Steinhardt
With Go 1.16, the ioutil package was deprecated. Replace our usage of `ioutil.ReadFile()` with `os.ReadFile()` to adapt accordingly.
2021-09-07safe: Rename `CreateFileWriter()` to be more idiomaticPatrick Steinhardt
In Gitaly, constructors for structs are typically called `NewStruct()`. Rename `CreateFileWriter()` to `NewFileWriter()` to better match our coding style.
2021-08-31global: Reformat sources with gofumptPatrick Steinhardt
Reformat sources with gofumpt.
2021-07-28lint: Fix deprecated import github.com/golang/protobuf/protoPavlo Strokov
The dependency github.com/golang/protobuf is deprecated and should be replaced with google.golang.org/protobuf. This change replaces usage of the proto package. The packages have incompatible API that is why the code changes were done to migrate. The exclusion rule removed from the golanci-lint tool configuration file to prevent future use of the deprecated package.
2021-07-22cache: Convert to use the locatorPatrick Steinhardt
Convert the cache package to use the locator interface to determine locations of cache and state directories. This will eventually allow us to get rid of the old interface.
2021-07-22storage: Move module into `internal/gitaly`Patrick Steinhardt
Except for a single use in Praefec's tests, the "storage" module is only used by Gitaly. Despite that, it's still located at `internal/storage` and thus indicates that it may be a generic component for reuse. Move it into `internal/gitaly` to clarify that it is indeed an implementation detail of Gitaly, only.
2021-05-27Create module v14 gitaly versionPavlo Strokov
The new "v14" version of the Gitaly module is named to match the next GitLab release. The module versioning is needed in order to pull gitaly as a dependency in other projects. The change updates all imports to include v14 version. The go.mod file was modified as well after go mod tidy execution. And the changes in dependency licenses are reflected in the NOTICE file. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/3177
2021-05-17cache: Move metrics into `Cache` structurePatrick Steinhardt
The `Cache` structure is now the single gatekeeper to interact with disk caches. As such, we can use it to host all counters and get rid of the global metric variables.
2021-05-17cache: Internalize the `LeaseKeyer` structurePatrick Steinhardt
Now that the `Cache` structure is the only interface external callers interact with, let's make the `LeaseKeyer` structure internal to the cache package.
2021-01-14cache: Use locator to resolve storage locationsPatrick Steinhardt
The cache LeaseKeyer needs to be able to resolve storage locations, which is currently done via the global `config.Config` variable. This commit converts it to instead use the locator, which is now available starting with the preceding commit.
2021-01-14cache: Make locator available to the LeaseKeyerPatrick Steinhardt
The cache LeaseKeyer needs to be able to resolve storage locations in order to identify where temporary data shall be stored. This is currently done via the global `config.Config`, which we're slowly getting rid of. This commit injects a locator into the LeaseKeyer such that we can get rid of the global config dependency in a subsequent commit.
2021-01-14cache: Introduce a constructor for the LeaseKeyer structPatrick Steinhardt
The LeaseKeyer structure is currently initialized ad-hoc in all locations. This has been fine for now as the structure hasn't got any members anyway. But we're about to add a locator to it, and continuing to use struct initialization directly would not result in any hints by the compiler that something has changed. Let's prepare the code for the added member by introducing a constructor and convert all call sites to use it.
2021-01-14cache: Use proper error wrappingPatrick Steinhardt
We're currently using "%s" and "%v" to format errors, which is considered to be bad style since Go 1.13 introduced new-style error handling. Let's convert those formatting directives to "%w" to fix this code smell and silence the linter.
2020-09-07gitaly: Move Gitaly-specific code into `internal/gitaly`Patrick Steinhardt
Since the introduction of Praefect, our code layout started to become confusing: while Praefect code lives in `internal/praefect`, Gitaly-specific code is all over the place and not neatly singled out. This makes it hard at times to tell apart Praefect- and Gitaly-specific from generic code. To improve the situation, this commit thus moves most of the server specific code into a new `internal/gitaly` package. Currently, this is the `internal/config`, `internal/server`, `internal/service` and `internal/rubyserver` packages, which are all main components of Gitaly. The move was realized with the following script: #!/bin/sh mkdir -p internal/gitaly git mv internal/{config,server,service,rubyserver} internal/gitaly/ find . -name '*.go' -exec sed -i \ -e 's|gitlab-org/gitaly/internal/rubyserver|gitlab-org/gitaly/internal/gitaly/rubyserver|' \ -e 's|gitlab-org/gitaly/internal/server|gitlab-org/gitaly/internal/gitaly/server|' \ -e 's|gitlab-org/gitaly/internal/service|gitlab-org/gitaly/internal/gitaly/service|' \ -e 's|gitlab-org/gitaly/internal/config|gitlab-org/gitaly/internal/gitaly/config|' {} \; In addition to that, some minor adjustments were needed for tests which used relative paths.
2020-06-30Turn feature flags into struct with default valueJohn Cai
Uses a struct for feature flags so there can be consistent behavior around enabled by default.
2020-06-18Remove dependency on global var to detect repo locationPavlo Strokov
Removes dependency on the global var config.Config to detect location of the repository of storage at the filesystem. Locator interface includes set of methods from helper package that are use in the services to get location of the repository. Implementation of the interface is injected into the context via tags mechanism. In order to break cyclic dependencies some of other funcs was also moved. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
2020-04-30improved path traversal protectionSami Hiltunen
Currently relative paths are validated against path traversals although in an incomplete manner. While relative paths with traversals do not cause problems for Gitaly in itself, we need be sure that every path accessed lies within the storage directories to ensure RPC callers can't access arbitrary paths. This commit replaces the path traversal checks by checking that the relative paths refer to paths within the root of the storage or the storage root itself.
2020-04-15Cache should account for feature flagsPaul Okstad
2020-04-09lint (static code analysis) enhancementsPavlo Strokov
lint must use Go1.13 as it is highest supported version. Fix deprecated use of `grpc_logrus.Extract`. New linters introduced and replacement of old ones in favor of new ones with same purpose. Fix of new linter errors.
2020-01-29Fix cache walker to only walk each path oncePaul Okstad
2019-12-13Log all diskcache state with gRPC metadataPaul Okstad
This adds an additional log message that will improve visibility of whether the diskcache is serving stale data or not. The "freshness" of the cache is determined by the repo's cache state file. The contents of this file will now be logged whenever it is updated. Additionally, the path of the cached response on disk will be logged each time the diskcache is used. This can be used to help determine if stale data is being served after the cache is expected to be invalid. Each time the state file changes, we expect a new request file path.
2019-09-25Move cache state files to +gitaly directoryJohn Cai
2019-09-18Fix cache invalidator for Create* RPCs and health checksPaul Okstad
2019-08-19Prevent lazy config lookups in tempdir cleanersJacob Vosmaer
2019-08-16Disk cache object directory initial clearPaul Okstad
2019-07-31Use embedded Go stubs for gitaly-protoJacob Vosmaer
2019-07-17Remove context from safe filePaul Okstad
2019-07-12Lease-based disk cache strategyPaul Okstad