Commit 4872158f authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix-gitaly-bin-dir' into 'master'

Remove `gitaly.client_path` and fix config.toml

See merge request gitlab-org/gitlab!61987
parents d47c7f31 48893dd1
......@@ -1089,8 +1089,6 @@ production: &base
# Gitaly settings
gitaly:
# Path to the directory containing Gitaly client executables.
client_path: /home/git/gitaly
# Default Gitaly authentication token. Can be overridden per storage. Can
# be left blank when Gitaly is running locally on a Unix socket, which
# is the normal way to deploy Gitaly.
......
......@@ -53,23 +53,6 @@ module Gitlab
gitaly_repository.relative_path == other_repository.relative_path
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
@repository.path
end
......
......@@ -129,7 +129,7 @@ module Gitlab
config[:'gitaly-ruby'] = { dir: File.join(gitaly_dir, 'ruby') } if gitaly_ruby
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[:logging] = { dir: Rails.root.join('log').to_s }
......
......@@ -58,45 +58,4 @@ RSpec.describe Gitlab::Git::RemoteRepository, :seed_helper do
it { expect(subject.same_repository?(other_repository)).to eq(result) }
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
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