blob: 554060250acda83bc05de84d91f1237c3f7d1fce (
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
35
36
|
require 'net/http'
class Registry
attr_accessor :path_with_namespace, :project
def initialize(path_with_namespace, project)
@path_with_namespace = path_with_namespace
@project = project
end
def tags
@tags ||= client.tags(path_with_namespace)
end
def tag(reference)
return @tag[reference] if defined?(@tag[reference])
@tag ||= {}
@tag[reference] ||= client.tag(path_with_namespace, reference)
end
def destroy_tag(reference)
client.delete_tag(path_with_namespace, reference)
end
def blob_size(blob)
return @blob_size[reference] if defined?(@blob_size[blob])
@blob_size ||= {}
@blob_size[blob] ||= client.blob_size(path_with_namespace, blob)
end
private
def client
@client ||= RegistryClient.new(Gitlab.config.registry.api_url)
end
end
|