diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-26 11:05:24 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-26 15:47:29 +0300 |
commit | e7fa825668f2c57885d29f8ea77bd8a92102c0e0 (patch) | |
tree | c05d367bf04ebe10fff48b7262ccf6356b5f5a45 /ruby | |
parent | 0663898ba5ba01894c7cbbdc38609edc02ed320b (diff) |
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
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/proto/gitaly/repository-service_pb.rb | 8 | ||||
-rw-r--r-- | ruby/proto/gitaly/repository-service_services_pb.rb | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ruby/proto/gitaly/repository-service_pb.rb b/ruby/proto/gitaly/repository-service_pb.rb index 09e3de5c6..9646b4709 100644 --- a/ruby/proto/gitaly/repository-service_pb.rb +++ b/ruby/proto/gitaly/repository-service_pb.rb @@ -341,6 +341,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do end add_message "gitaly.OptimizeRepositoryResponse" do end + add_message "gitaly.SetFullPathRequest" do + optional :repository, :message, 1, "gitaly.Repository" + optional :path, :string, 2 + end + add_message "gitaly.SetFullPathResponse" do + end end end @@ -437,4 +443,6 @@ module Gitaly ReplicateRepositoryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ReplicateRepositoryResponse").msgclass OptimizeRepositoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.OptimizeRepositoryRequest").msgclass OptimizeRepositoryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.OptimizeRepositoryResponse").msgclass + SetFullPathRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SetFullPathRequest").msgclass + SetFullPathResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SetFullPathResponse").msgclass end diff --git a/ruby/proto/gitaly/repository-service_services_pb.rb b/ruby/proto/gitaly/repository-service_services_pb.rb index eceacad85..c49b59c17 100644 --- a/ruby/proto/gitaly/repository-service_services_pb.rb +++ b/ruby/proto/gitaly/repository-service_services_pb.rb @@ -66,6 +66,11 @@ module Gitaly rpc :RenameRepository, ::Gitaly::RenameRepositoryRequest, ::Gitaly::RenameRepositoryResponse rpc :ReplicateRepository, ::Gitaly::ReplicateRepositoryRequest, ::Gitaly::ReplicateRepositoryResponse rpc :OptimizeRepository, ::Gitaly::OptimizeRepositoryRequest, ::Gitaly::OptimizeRepositoryResponse + # 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, ::Gitaly::SetFullPathRequest, ::Gitaly::SetFullPathResponse end Stub = Service.rpc_stub_class |