summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-06-12 17:37:43 -0400
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-06-13 00:15:56 -0400
commit824d5061605dcdfc35b809e1cbdb51ef735d85e9 (patch)
treea023ee296ee0414ef9cb158def54edb3943df205
parent652eb0118b3cf87f96dfbaacf5802d974303e427 (diff)
downloadgitlab-ce-deprecate-gitaly-path.tar.gz
Stop using deprecated `path` field on Gitaly messagesdeprecate-gitaly-path
This revealed an error in our configuration generation in gitlab:gitaly:install rake task. The fix is included
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--lib/gitlab/gitaly_client/util.rb1
-rw-r--r--lib/tasks/gitlab/gitaly.rake20
-rw-r--r--spec/tasks/gitlab/gitaly_rake_spec.rb11
4 files changed, 20 insertions, 14 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index bc859cbd6d9..a0751d1f353 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-0.11.2
+=151-gitaly-gitlab-ce-workhorse-possibly-gitlab-shell-deprecate-repository-path
diff --git a/lib/gitlab/gitaly_client/util.rb b/lib/gitlab/gitaly_client/util.rb
index 86d055d3533..f5a4c5493ef 100644
--- a/lib/gitlab/gitaly_client/util.rb
+++ b/lib/gitlab/gitaly_client/util.rb
@@ -4,7 +4,6 @@ module Gitlab
class << self
def repository(repository_storage, relative_path)
Gitaly::Repository.new(
- path: File.join(Gitlab.config.repositories.storages[repository_storage]['path'], relative_path),
storage_name: repository_storage,
relative_path: relative_path
)
diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake
index 3c5bc0146a1..e88111c3725 100644
--- a/lib/tasks/gitlab/gitaly.rake
+++ b/lib/tasks/gitlab/gitaly.rake
@@ -30,11 +30,7 @@ namespace :gitlab do
puts "# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}"
puts "# This is in TOML format suitable for use in Gitaly's config.toml file."
- config = Gitlab.config.repositories.storages.map do |key, val|
- { name: key, path: val['path'] }
- end
-
- puts TOML.dump(storage: config)
+ puts gitaly_configuration_toml
end
private
@@ -42,10 +38,10 @@ namespace :gitlab do
# We cannot create config.toml files for all possible Gitaly configuations.
# For instance, if Gitaly is running on another machine then it makes no
# sense to write a config.toml file on the current machine. This method will
- # only write a config.toml file in the most common and simplest case: the
- # case where we have exactly one Gitaly process and we are sure it is
- # running locally because it uses a Unix socket.
- def create_gitaly_configuration
+ # only generate a configuration for the most common and simplest case: when
+ # we have exactly one Gitaly process and we are sure it is running locally
+ # because it uses a Unix socket.
+ def gitaly_configuration_toml
storages = []
address = nil
@@ -63,8 +59,12 @@ namespace :gitlab do
storages << { name: key, path: val['path'] }
end
+ TOML.dump(socket_path: address.sub(%r{\Aunix:}, ''), storage: storages)
+ end
+
+ def create_gitaly_configuration
File.open("config.toml", "w") do |f|
- f.puts TOML.dump(socket_path: address.sub(%r{\Aunix:}, ''), storages: storages)
+ f.puts gitaly_configuration_toml
end
rescue ArgumentError => e
puts "Skipping config.toml generation:"
diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb
index 4a636decafd..cfa6c9ca8ce 100644
--- a/spec/tasks/gitlab/gitaly_rake_spec.rb
+++ b/spec/tasks/gitlab/gitaly_rake_spec.rb
@@ -79,8 +79,14 @@ describe 'gitlab:gitaly namespace rake task' do
describe 'storage_config' do
it 'prints storage configuration in a TOML format' do
config = {
- 'default' => { 'path' => '/path/to/default' },
- 'nfs_01' => { 'path' => '/path/to/nfs_01' }
+ 'default' => {
+ 'path' => '/path/to/default',
+ 'gitaly_address' => 'unix:/path/to/my.socket'
+ },
+ 'nfs_01' => {
+ 'path' => '/path/to/nfs_01',
+ 'gitaly_address' => 'unix:/path/to/my.socket'
+ }
}
allow(Gitlab.config.repositories).to receive(:storages).and_return(config)
@@ -89,6 +95,7 @@ describe 'gitlab:gitaly namespace rake task' do
expected_output = <<~TOML
# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}
# This is in TOML format suitable for use in Gitaly's config.toml file.
+ socket_path = "/path/to/my.socket"
[[storage]]
name = "default"
path = "/path/to/default"