Commit c84272dc authored by Robert Speicher's avatar Robert Speicher

Merge branch 'feature/gitaly-feature-flag' into 'master'

Gitaly feature flag

See merge request !8440
parents 639b880e 0a1c8bb3
---
title: Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabled
merge_request: 8440
author:
......@@ -403,6 +403,12 @@ Settings.rack_attack.git_basic_auth['maxretry'] ||= 10
Settings.rack_attack.git_basic_auth['findtime'] ||= 1.minute
Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
#
# Gitaly
#
Settings['gitaly'] ||= Settingslogic.new({})
Settings.gitaly['socket_path'] ||= ENV['GITALY_SOCKET_PATH']
#
# Testing settings
#
......
......@@ -15,10 +15,17 @@ module Gitlab
class << self
def git_http_ok(repository, user)
{
params = {
GL_ID: Gitlab::GlId.gl_id(user),
RepoPath: repository.path_to_repo,
}
params.merge!(
GitalySocketPath: Gitlab.config.gitaly.socket_path,
GitalyResourcePath: "/projects/#{repository.project.id}/git-http/info-refs",
) if Gitlab.config.gitaly.socket_path.present?
params
end
def lfs_upload_ok(oid, size)
......
......@@ -174,4 +174,27 @@ describe Gitlab::Workhorse, lib: true do
described_class.verify_api_request!(headers)
end
end
describe '.git_http_ok' do
let(:user) { create(:user) }
subject { described_class.git_http_ok(repository, user) }
it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repository.path_to_repo }) }
context 'when Gitaly socket path is present' do
let(:gitaly_socket_path) { '/tmp/gitaly.sock' }
before do
allow(Gitlab.config.gitaly).to receive(:socket_path).and_return(gitaly_socket_path)
end
it 'includes Gitaly params in the returned value' do
expect(subject).to include({
GitalyResourcePath: "/projects/#{repository.project.id}/git-http/info-refs",
GitalySocketPath: gitaly_socket_path,
})
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