docker_registry2 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/registry/registry.rb +22 -17
- data/lib/registry/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1591b5d46dda76268ee84b6cc588c6ecd311eb6a2f2627e7522ef516b64c1d84
|
4
|
+
data.tar.gz: 9c614d30dab2ca67e50f29d0dba6a320d1ba8c50a493373b7e035469f31de2cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e6aba5f883fa302753047e5949542e746d6b17f76dc069a79b0f842a46dc2c643bd1c05c58aa977548c503d5a1c32f15ff9b2b6c4b1a5eb4c7f459a12a7b1f
|
7
|
+
data.tar.gz: d755b52601c9891064eb3c9e72b285ffdb7099fd39eaff4a96d1e419597adc6c03c0f3e6b65f4a1f0070db97fdbf576c792f3d1a644d056af32c913c2cc3dbfd
|
data/lib/registry/registry.rb
CHANGED
@@ -49,33 +49,27 @@ class DockerRegistry2::Registry
|
|
49
49
|
return repos
|
50
50
|
end
|
51
51
|
|
52
|
-
def tags(repo,count=nil,last="",withHashes = false)
|
52
|
+
def tags(repo,count=nil,last="",withHashes = false, auto_paginate: false)
|
53
53
|
#create query params
|
54
54
|
params = []
|
55
|
-
if last != ""
|
56
|
-
|
57
|
-
end
|
58
|
-
if count != nil
|
59
|
-
params.push(["n",count])
|
60
|
-
end
|
55
|
+
params.push(["last",last]) if last && last != ""
|
56
|
+
params.push(["n",count]) unless count.nil?
|
61
57
|
|
62
58
|
query_vars = ""
|
63
|
-
if params.length > 0
|
64
|
-
|
65
|
-
end
|
59
|
+
query_vars = "?#{URI.encode_www_form(params)}" if params.length > 0
|
60
|
+
|
66
61
|
response = doget "/v2/#{repo}/tags/list#{query_vars}"
|
67
62
|
# parse the response
|
68
63
|
resp = JSON.parse response
|
69
64
|
# parse out next page link if necessary
|
70
|
-
if response.headers[:link]
|
71
|
-
|
72
|
-
end
|
65
|
+
resp["last"] = last(response.headers[:link]) if response.headers[:link]
|
66
|
+
|
73
67
|
# do we include the hashes?
|
74
|
-
if withHashes
|
68
|
+
if withHashes
|
75
69
|
useGet = false
|
76
70
|
resp["hashes"] = {}
|
77
|
-
resp["tags"].each
|
78
|
-
if useGet
|
71
|
+
resp["tags"].each do |tag|
|
72
|
+
if useGet
|
79
73
|
head = doget "/v2/#{repo}/manifests/#{tag}"
|
80
74
|
else
|
81
75
|
begin
|
@@ -87,8 +81,19 @@ class DockerRegistry2::Registry
|
|
87
81
|
end
|
88
82
|
end
|
89
83
|
resp["hashes"][tag] = head.headers[:docker_content_digest]
|
90
|
-
|
84
|
+
end
|
91
85
|
end
|
86
|
+
|
87
|
+
return resp unless auto_paginate
|
88
|
+
|
89
|
+
while (last_tag = resp.delete("last"))
|
90
|
+
additional_tags = tags(repo, count, last_tag, withHashes)
|
91
|
+
resp["last"] = additional_tags["last"]
|
92
|
+
resp["tags"] += additional_tags["tags"]
|
93
|
+
resp["tags"] = resp["tags"].uniq
|
94
|
+
resp["hashes"].merge!(additional_tags["hashes"]) if withHashes
|
95
|
+
end
|
96
|
+
|
92
97
|
resp
|
93
98
|
end
|
94
99
|
|
data/lib/registry/version.rb
CHANGED