blob: 86e696f87a42a9152f17f94a3db8192ed77042f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
module BulkImports
module Projects
module Pipelines
class RepositoryPipeline
include Pipeline
abort_on_failure!
extractor Common::Extractors::GraphqlExtractor, query: Graphql::GetRepositoryQuery
def transform(_, data)
data.slice('httpUrlToRepo')
end
def load(context, data)
url = data['httpUrlToRepo']
url = url.sub("://", "://oauth2:#{context.configuration.access_token}@")
Gitlab::UrlBlocker.validate!(url, allow_local_network: allow_local_requests?, allow_localhost: allow_local_requests?)
context.portable.repository.import_repository(url)
end
private
def allow_local_requests?
Gitlab::CurrentSettings.allow_local_requests_from_web_hooks_and_services?
end
end
end
end
end
|