summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-06-20 16:09:58 +0200
committerJacob Vosmaer <jacob@gitlab.com>2017-06-20 16:19:43 +0200
commit7bda1030a59b0723eade42b03f72918a75c20e9d (patch)
tree045d3f93fa0458647e49b359845c803ff1df67d2
parent76bafc00e62b3a90252f0d229c7ce98c2691da30 (diff)
downloadgitlab-ce-7bda1030a59b0723eade42b03f72918a75c20e9d.tar.gz
Send gitaly token to workhorse when needed
-rw-r--r--lib/gitlab/workhorse.rb11
-rw-r--r--spec/lib/gitlab/workhorse_spec.rb6
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index 7f27317775c..43305f63911 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -26,7 +26,10 @@ module Gitlab
}
if Gitlab.config.gitaly.enabled
- address = Gitlab::GitalyClient.address(project.repository_storage)
+ server = {
+ address: Gitlab::GitalyClient.address(project.repository_storage),
+ token: Gitlab::GitalyClient.token(project.repository_storage),
+ }
params[:Repository] = repository.gitaly_repository.to_h
feature_enabled = case action.to_s
@@ -39,8 +42,10 @@ module Gitlab
else
raise "Unsupported action: #{action}"
end
-
- params[:GitalyAddress] = address if feature_enabled
+ if feature_enabled
+ params[:GitalyAddress] = server[:address] # This field will be deprecated
+ params[:GitalyServer] = server
+ end
end
params
diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb
index ad19998dff4..a3e8166cb70 100644
--- a/spec/lib/gitlab/workhorse_spec.rb
+++ b/spec/lib/gitlab/workhorse_spec.rb
@@ -202,7 +202,11 @@ describe Gitlab::Workhorse, lib: true do
context 'when Gitaly is enabled' do
let(:gitaly_params) do
{
- GitalyAddress: Gitlab::GitalyClient.address('default')
+ GitalyAddress: Gitlab::GitalyClient.address('default'),
+ GitalyServer: {
+ address: Gitlab::GitalyClient.address('default'),
+ token: Gitlab::GitalyClient.token('default')
+ }
}
end