2018-11-09 18:39:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-18 23:58:20 +00:00
|
|
|
module Gitlab
|
|
|
|
module Git
|
|
|
|
class RemoteMirror
|
2018-10-30 13:37:40 +00:00
|
|
|
include Gitlab::Git::WrapsGitalyErrors
|
|
|
|
|
2018-11-12 10:52:48 +00:00
|
|
|
attr_reader :repository, :ref_name, :only_branches_matching, :ssh_key, :known_hosts
|
|
|
|
|
|
|
|
def initialize(repository, ref_name, only_branches_matching: [], ssh_key: nil, known_hosts: nil)
|
2017-12-18 23:58:20 +00:00
|
|
|
@repository = repository
|
|
|
|
@ref_name = ref_name
|
2018-11-12 10:52:48 +00:00
|
|
|
@only_branches_matching = only_branches_matching
|
|
|
|
@ssh_key = ssh_key
|
|
|
|
@known_hosts = known_hosts
|
2017-12-18 23:58:20 +00:00
|
|
|
end
|
|
|
|
|
2018-11-12 10:52:48 +00:00
|
|
|
def update
|
2018-10-30 13:37:40 +00:00
|
|
|
wrapped_gitaly_errors do
|
2018-11-12 10:52:48 +00:00
|
|
|
repository.gitaly_remote_client.update_remote_mirror(
|
|
|
|
ref_name,
|
|
|
|
only_branches_matching,
|
|
|
|
ssh_key: ssh_key,
|
|
|
|
known_hosts: known_hosts
|
|
|
|
)
|
2017-12-18 23:58:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|