diff options
Diffstat (limited to 'app/services/dependency_proxy/pull_manifest_service.rb')
-rw-r--r-- | app/services/dependency_proxy/pull_manifest_service.rb | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/app/services/dependency_proxy/pull_manifest_service.rb b/app/services/dependency_proxy/pull_manifest_service.rb deleted file mode 100644 index e8f0ad6374a..00000000000 --- a/app/services/dependency_proxy/pull_manifest_service.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module DependencyProxy - class PullManifestService < DependencyProxy::BaseService - def initialize(image, tag, token) - @image = image - @tag = tag - @token = token - end - - def execute_with_manifest - raise ArgumentError, 'Block must be provided' unless block_given? - - response = Gitlab::HTTP.get(manifest_url, headers: auth_headers.merge(Accept: ::ContainerRegistry::Client::ACCEPTED_TYPES.join(','))) - - if response.success? - file = Tempfile.new - - begin - file.write(response.body) - file.flush - - yield( - success( - file: file, - digest: response.headers[DependencyProxy::Manifest::DIGEST_HEADER], - content_type: response.headers['content-type'] - ) - ) - ensure - file.close - file.unlink - end - else - yield(error(response.body, response.code)) - end - rescue Timeout::Error => exception - error(exception.message, 599) - end - - private - - def manifest_url - registry.manifest_url(@image, @tag) - end - end -end |