Commit 48893dd1 authored by Kamil Trzciński's avatar Kamil Trzciński

Remove `gitaly.client_path` and fix config.toml

This removes unused `gitaly.client_path` and fixes
a source installation of gitaly to reflect a specified
path in a `rake "gitlab:gitaly:install[/home/git/gitaly2,...]"`
parent de7dabeb
...@@ -1089,8 +1089,6 @@ production: &base ...@@ -1089,8 +1089,6 @@ production: &base
# Gitaly settings # Gitaly settings
gitaly: gitaly:
# Path to the directory containing Gitaly client executables.
client_path: /home/git/gitaly
# Default Gitaly authentication token. Can be overridden per storage. Can # Default Gitaly authentication token. Can be overridden per storage. Can
# be left blank when Gitaly is running locally on a Unix socket, which # be left blank when Gitaly is running locally on a Unix socket, which
# is the normal way to deploy Gitaly. # is the normal way to deploy Gitaly.
......
...@@ -53,23 +53,6 @@ module Gitlab ...@@ -53,23 +53,6 @@ module Gitlab
gitaly_repository.relative_path == other_repository.relative_path gitaly_repository.relative_path == other_repository.relative_path
end end
def fetch_env
gitaly_ssh = File.absolute_path(File.join(Gitlab.config.gitaly.client_path, 'gitaly-ssh'))
gitaly_address = gitaly_client.address(storage)
gitaly_token = gitaly_client.token(storage)
request = Gitaly::SSHUploadPackRequest.new(repository: gitaly_repository)
env = {
'GITALY_ADDRESS' => gitaly_address,
'GITALY_PAYLOAD' => request.to_json,
'GITALY_WD' => Dir.pwd,
'GIT_SSH_COMMAND' => "#{gitaly_ssh} upload-pack"
}
env['GITALY_TOKEN'] = gitaly_token if gitaly_token.present?
env
end
def path def path
@repository.path @repository.path
end end
......
...@@ -129,7 +129,7 @@ module Gitlab ...@@ -129,7 +129,7 @@ module Gitlab
config[:'gitaly-ruby'] = { dir: File.join(gitaly_dir, 'ruby') } if gitaly_ruby config[:'gitaly-ruby'] = { dir: File.join(gitaly_dir, 'ruby') } if gitaly_ruby
config[:'gitlab-shell'] = { dir: Gitlab.config.gitlab_shell.path } config[:'gitlab-shell'] = { dir: Gitlab.config.gitlab_shell.path }
config[:bin_dir] = Gitlab.config.gitaly.client_path config[:bin_dir] = File.join(gitaly_dir, '_build', 'bin') # binaries by default are in `_build/bin`
config[:gitlab] = { url: Gitlab.config.gitlab.url } config[:gitlab] = { url: Gitlab.config.gitlab.url }
config[:logging] = { dir: Rails.root.join('log').to_s } config[:logging] = { dir: Rails.root.join('log').to_s }
......
...@@ -58,45 +58,4 @@ RSpec.describe Gitlab::Git::RemoteRepository, :seed_helper do ...@@ -58,45 +58,4 @@ RSpec.describe Gitlab::Git::RemoteRepository, :seed_helper do
it { expect(subject.same_repository?(other_repository)).to eq(result) } it { expect(subject.same_repository?(other_repository)).to eq(result) }
end end
end end
describe '#fetch_env' do
let(:remote_repository) { described_class.new(repository) }
let(:gitaly_client) { double(:gitaly_client) }
let(:address) { 'fake-address' }
let(:token) { 'fake-token' }
subject { remote_repository.fetch_env }
before do
allow(remote_repository).to receive(:gitaly_client).and_return(gitaly_client)
expect(gitaly_client).to receive(:address).with(repository.storage).and_return(address)
expect(gitaly_client).to receive(:token).with(repository.storage).and_return(token)
end
it { expect(subject).to be_a(Hash) }
it { expect(subject['GITALY_ADDRESS']).to eq(address) }
it { expect(subject['GITALY_TOKEN']).to eq(token) }
it { expect(subject['GITALY_WD']).to eq(Dir.pwd) }
it 'creates a plausible GIT_SSH_COMMAND' do
git_ssh_command = subject['GIT_SSH_COMMAND']
expect(git_ssh_command).to start_with('/')
expect(git_ssh_command).to end_with('/gitaly-ssh upload-pack')
end
it 'creates a plausible GITALY_PAYLOAD' do
req = Gitaly::SSHUploadPackRequest.decode_json(subject['GITALY_PAYLOAD'])
expect(remote_repository.gitaly_repository).to eq(req.repository)
end
context 'when the token is blank' do
let(:token) { '' }
it { expect(subject.keys).not_to include('GITALY_TOKEN') }
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment