Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-02 03:09:24 +00:00
parent d5c627d3cc
commit 81bf69a329
8 changed files with 24 additions and 10 deletions

View File

@ -481,7 +481,7 @@ gem 'ssh_data', '~> 1.2'
gem 'spamcheck', '~> 0.1.0'
# Gitaly GRPC protocol definitions
gem 'gitaly', '~> 14.9.0.pre.rc4'
gem 'gitaly', '~> 14.9.0-rc5'
# KAS GRPC protocol definitions
gem 'kas-grpc', '~> 0.0.2'

View File

@ -455,7 +455,7 @@ GEM
rails (>= 3.2.0)
git (1.7.0)
rchardet (~> 1.8)
gitaly (14.9.0.pre.rc4)
gitaly (14.9.0.pre.rc5)
grpc (~> 1.0)
github-markup (1.7.0)
gitlab (4.16.1)
@ -534,7 +534,7 @@ GEM
signet (~> 0.12)
google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0)
google-protobuf (3.19.1)
google-protobuf (3.19.4)
googleapis-common-protos-types (1.3.0)
google-protobuf (~> 3.14)
googleauth (0.14.0)
@ -1492,7 +1492,7 @@ DEPENDENCIES
gettext (~> 3.3)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
gitaly (~> 14.9.0.pre.rc4)
gitaly (~> 14.9.0.pre.rc5)
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-dangerfiles (~> 3.0)

View File

@ -941,6 +941,10 @@ class Repository
end
end
def clone_as_mirror(url, http_authorization_header: "")
import_repository(url, http_authorization_header: http_authorization_header, mirror: true)
end
def fetch_as_mirror(url, forced: false, refmap: :all_refs, prune: true, http_authorization_header: "")
fetch_remote(url, refmap: refmap, forced: forced, prune: prune, http_authorization_header: http_authorization_header)
end

View File

@ -0,0 +1,8 @@
---
name: geo_use_clone_on_first_sync
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77143
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/357462
milestone: '14.10'
type: development
group: group::geo
default_enabled: false

View File

@ -841,11 +841,11 @@ module Gitlab
end
end
def import_repository(url)
def import_repository(url, http_authorization_header: '', mirror: false)
raise ArgumentError, "don't use disk paths with import_repository: #{url.inspect}" if url.start_with?('.', '/')
wrapped_gitaly_errors do
gitaly_repository_client.import_repository(url)
gitaly_repository_client.import_repository(url, http_authorization_header: http_authorization_header, mirror: mirror)
end
end

View File

@ -145,10 +145,12 @@ module Gitlab
)
end
def import_repository(source)
def import_repository(source, http_authorization_header: '', mirror: false)
request = Gitaly::CreateRepositoryFromURLRequest.new(
repository: @gitaly_repo,
url: source
url: source,
http_authorization_header: http_authorization_header,
mirror: mirror
)
GitalyClient.call(

View File

@ -2448,7 +2448,7 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do
it 'delegates to Gitaly' do
expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |svc|
expect(svc).to receive(:import_repository).with(url).and_return(nil)
expect(svc).to receive(:import_repository).with(url, http_authorization_header: '', mirror: false).and_return(nil)
end
repository.import_repository(url)

View File

@ -22,7 +22,7 @@ RSpec.describe ProjectImportState, type: :model do
before do
allow_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:import_repository)
.with(project.import_url).and_return(true)
.with(project.import_url, http_authorization_header: '', mirror: false).and_return(true)
# Works around https://github.com/rspec/rspec-mocks/issues/910
allow(Project).to receive(:find).with(project.id).and_return(project)