From e7fa825668f2c57885d29f8ea77bd8a92102c0e0 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 26 Jul 2021 10:05:24 +0200 Subject: repository: Implement new `SetFullPath()` RPC Since quite some time, we have tried to get rid of calls which modify the on-disk gitconfig file. For one these include calls which add or remove remotes, which are soon to be removed from Gitaly now that Rails doesn't call them anymore. On the other hand, this also includes calls which modify the gitconfig directly. There are currently two upstream callers of those RPCs: - The first usecase is to set up JWT credentials for `FetchRemote()` calls. Those credentials are passed via HTTP headers, which is in fact already supported by `FetchRemote` without having to manually write them into the gitconfig. Those are thus easy to replace. - The second usecase is to set "gitlab.fullpath": this key simply records the repository's path in GitLab such that it's easy to see for admins what repository this is. This has been implemented to bridge the gap between the old storage layout and our new hashed storages. This commit addresses the second usecase by introducing a new RPC `SetFullPath()`. Instead of allowing callers to modify the gitconfig arbitrarily, this will only allow callers to explicitly set "gitlab.fullpath". With this in place, we can eventually remove `AddConfig()` and `RemoveConfig()` given that they're not required anymore. Changelog: added --- proto/repository-service.proto | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'proto/repository-service.proto') diff --git a/proto/repository-service.proto b/proto/repository-service.proto index f38a20126..e7801e691 100644 --- a/proto/repository-service.proto +++ b/proto/repository-service.proto @@ -239,6 +239,16 @@ service RepositoryService { op: MUTATOR }; } + + // SetFullPath writes the "gitlab.fullpath" configuration into the + // repository's gitconfig. This is mainly to help debugging purposes in case + // an admin inspects the repository's gitconfig such that he can easily see + // what the repository name is. + rpc SetFullPath(SetFullPathRequest) returns (SetFullPathResponse) { + option (op_type) = { + op: MUTATOR + }; + } } message RepositoryExistsRequest { @@ -739,3 +749,14 @@ message OptimizeRepositoryRequest { } message OptimizeRepositoryResponse{} + +// SetFullPathRequest is a request for the SetFullPath RPC. +message SetFullPathRequest { + // Repository is the repository whose gitconfig should be written to. + Repository repository = 1 [(target_repository)=true]; + // Path is the path that shall be written into the "gitlab.fullpath" config key. + string path = 2; +} + +// SetFullPathResponse is a response fqor the SetFullPath RPC. +message SetFullPathResponse {} -- cgit v1.2.3