Class: DependencyProxy::FindCachedManifestService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- DependencyProxy::FindCachedManifestService
- Defined in:
- app/services/dependency_proxy/find_cached_manifest_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(group, image, tag, token) ⇒ FindCachedManifestService
constructor
A new instance of FindCachedManifestService.
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(group, image, tag, token) ⇒ FindCachedManifestService
Returns a new instance of FindCachedManifestService.
5 6 7 8 9 10 11 12 |
# File 'app/services/dependency_proxy/find_cached_manifest_service.rb', line 5 def initialize(group, image, tag, token) @group = group @image = image @tag = tag @token = token @file_name = "#{@image}:#{@tag}.json" @manifest = nil end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/dependency_proxy/find_cached_manifest_service.rb', line 14 def execute @manifest = @group.dependency_proxy_manifests .active .find_by_file_name_or_digest(file_name: @file_name, digest: @tag) head_result = DependencyProxy::HeadManifestService.new(@image, @tag, @token).execute return respond if cached_manifest_matches?(head_result) return respond if @manifest && head_result[:status] == :error success(manifest: nil, from_cache: false) rescue Timeout::Error, *Gitlab::HTTP::HTTP_ERRORS respond end |