docker_registry2 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/registry/registry.rb +34 -8
- data/lib/registry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 869a69624555c180f16132300dfc203787a4e3ffd616f49f26ec7f199b469f1a
|
4
|
+
data.tar.gz: cab7c1746af1ef6956726f42524da542f2ebf9a2fe4a56cc793148aa04a285d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 953669f5e94fef460fe7a3d866964aa76c87a29b2e2285ecb9a85a7058c43317ea1a683aa96e4c23bda450f48805edbc5c681f601ce00a81ae1e93020f6e02c0
|
7
|
+
data.tar.gz: 02fbf888184e024bdf49a62b8b2e4161ae02d1df7f265bbf93aa5e4244fde50221e4fd93e085c291f4333c2ba691ffcc469d016832091c8cb3a286bea39978ba
|
data/lib/registry/registry.rb
CHANGED
@@ -38,15 +38,34 @@ class DockerRegistry2::Registry
|
|
38
38
|
return doreq "head", url
|
39
39
|
end
|
40
40
|
|
41
|
+
# When a result set is too large, the Docker registry returns only the first items and adds a Link header in the
|
42
|
+
# response with the URL of the next page. See <https://docs.docker.com/registry/spec/api/#pagination>. This method
|
43
|
+
# iterates over the pages and calls the given block with each response.
|
44
|
+
def paginate_doget(url)
|
45
|
+
while url
|
46
|
+
response = doget(url)
|
47
|
+
yield response
|
48
|
+
|
49
|
+
if (link = response.headers[:link])
|
50
|
+
url = parse_link_header(link)[:next]
|
51
|
+
else
|
52
|
+
break
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
41
57
|
def search(query = '')
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
58
|
+
all_repos = []
|
59
|
+
paginate_doget "/v2/_catalog" do |response|
|
60
|
+
# parse the response
|
61
|
+
repos = JSON.parse(response)["repositories"]
|
62
|
+
if query.strip.length > 0
|
63
|
+
re = Regexp.new query
|
64
|
+
repos = repos.find_all {|e| re =~ e }
|
65
|
+
end
|
66
|
+
all_repos += repos
|
48
67
|
end
|
49
|
-
|
68
|
+
all_repos
|
50
69
|
end
|
51
70
|
|
52
71
|
def tags(repo,count=nil,last="",withHashes = false, auto_paginate: false)
|
@@ -208,7 +227,9 @@ class DockerRegistry2::Registry
|
|
208
227
|
Integer(response.headers[:content_length],10)
|
209
228
|
end
|
210
229
|
|
211
|
-
|
230
|
+
# Parse the value of the Link HTTP header and return a Hash whose keys are the rel values turned into symbols, and
|
231
|
+
# the values are URLs. For example, `{ next: '/v2/_catalog?n=100&last=x' }`.
|
232
|
+
def parse_link_header(header)
|
212
233
|
last=''
|
213
234
|
parts = header.split(',')
|
214
235
|
links = Hash.new
|
@@ -221,6 +242,11 @@ class DockerRegistry2::Registry
|
|
221
242
|
links[name] = url
|
222
243
|
end
|
223
244
|
|
245
|
+
links
|
246
|
+
end
|
247
|
+
|
248
|
+
def last(header)
|
249
|
+
links = parse_link_header(header)
|
224
250
|
if links[:next]
|
225
251
|
query=URI(links[:next]).query
|
226
252
|
link_key = @uri.host.eql?('quay.io') ? 'next_page' : 'last'
|
data/lib/registry/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker_registry2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avi Deitcher https://github.com/deitch
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|