Commit 42437c33 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Merge branch 'zj-workhorse-archive-mandatory' into 'master'

Move git archives downloading to Gitaly

See merge request gitlab-org/gitlab-ce!18990
---
title: Workhorse will use Gitaly to create archives
merge_request:
author:
type: other
......@@ -403,10 +403,10 @@ def archive_metadata(ref, storage_path, format = "tar.gz", append_sha:)
prefix = archive_prefix(ref, commit.id, append_sha: append_sha)
{
'RepoPath' => path,
'ArchivePrefix' => prefix,
'ArchivePath' => archive_file_path(storage_path, commit.id, prefix, format),
'CommitId' => commit.id
'CommitId' => commit.id,
'GitalyRepository' => gitaly_repository.to_h
}
end
......
......@@ -65,12 +65,7 @@ def send_git_archive(repository, ref:, format:, append_sha:)
params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format, append_sha: append_sha)
raise "Repository or ref not found" if params.empty?
if Gitlab::GitalyClient.feature_enabled?(:workhorse_archive, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT)
params.merge!(
'GitalyServer' => gitaly_server_hash(repository),
'GitalyRepository' => repository.gitaly_repository.to_h
)
end
params['GitalyServer'] = gitaly_server_hash(repository)
# If present DisableCache must be a Boolean. Otherwise workhorse ignores it.
params['DisableCache'] = true if git_archive_cache_disabled?
......
......@@ -249,10 +249,6 @@
subject(:metadata) { repository.archive_metadata(ref, storage_path, format, append_sha: append_sha) }
it 'sets RepoPath to the repository path' do
expect(metadata['RepoPath']).to eq(repository.path)
end
it 'sets CommitId to the commit SHA' do
expect(metadata['CommitId']).to eq(SeedRepo::LastCommit::ID)
end
......
require 'spec_helper'
describe Gitlab::Workhorse do
let(:project) { create(:project, :repository) }
set(:project) { create(:project, :repository) }
let(:repository) { project.repository }
def decode_workhorse_header(array)
......@@ -55,16 +55,6 @@ def decode_workhorse_header(array)
end
end
context 'when Gitaly workhorse_archive feature is disabled', :disable_gitaly do
it 'sets the header correctly' do
key, command, params = decode_workhorse_header(subject)
expect(key).to eq('Gitlab-Workhorse-Send-Data')
expect(command).to eq('git-archive')
expect(params).to eq(base_params)
end
end
context "when the repository doesn't have an archive file path" do
before do
allow(project.repository).to receive(:archive_metadata).and_return(Hash.new)
......
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