docker_registry2 1.13.0 → 1.14.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 +15 -12
- 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: 6c331456d39ce2a4a57002e7117101f261b2b78bea3b056843430b6c8ccc2110
|
4
|
+
data.tar.gz: 2370009afd0319cfc35a49443e51ad6566508362e5cf3fce941af793c16ac885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a04a5987fa31cd7feb34d476f82b771e02fd4e5f93caeb4888ad27da0ab7b20cd5cf279f3f06954c599cf68ac930ed9183e5b0410ef90642110bd9ca859b62
|
7
|
+
data.tar.gz: 6ae15951f3f7ca11af1700a701fbc5e270f4adf9a9fb1998bb3657ef85fc79bd1c7cb18e1f9e598e8d592eec9d3c2dfb412d34c7c39fab26b7a3df69585b0dc0
|
data/lib/registry/registry.rb
CHANGED
@@ -5,7 +5,7 @@ require 'rest-client'
|
|
5
5
|
require 'json'
|
6
6
|
|
7
7
|
module DockerRegistry2
|
8
|
-
class Registry
|
8
|
+
class Registry # rubocop:disable Metrics/ClassLength
|
9
9
|
# @param [#to_s] base_uri Docker registry base URI
|
10
10
|
# @param [Hash] options Client options
|
11
11
|
# @option options [#to_s] :user User name for basic authentication
|
@@ -45,26 +45,22 @@ module DockerRegistry2
|
|
45
45
|
# response with the URL of the next page. See <https://docs.docker.com/registry/spec/api/#pagination>. This method
|
46
46
|
# iterates over the pages and calls the given block with each response.
|
47
47
|
def paginate_doget(url)
|
48
|
-
|
48
|
+
loop do
|
49
49
|
response = doget(url)
|
50
50
|
yield response
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
url = parse_link_header(link)[:next]
|
52
|
+
link_header = response.headers[:link]
|
53
|
+
break unless link_header
|
55
54
|
|
55
|
+
url = parse_link_header(link_header)[:next]
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def search(query = '')
|
60
60
|
all_repos = []
|
61
|
-
paginate_doget
|
62
|
-
# parse the response
|
61
|
+
paginate_doget('/v2/_catalog') do |response|
|
63
62
|
repos = JSON.parse(response)['repositories']
|
64
|
-
|
65
|
-
re = Regexp.new query
|
66
|
-
repos = repos.find_all { |e| re =~ e }
|
67
|
-
end
|
63
|
+
repos.select! { |repo| repo.match?(/#{query}/) } unless query.empty?
|
68
64
|
all_repos += repos
|
69
65
|
end
|
70
66
|
all_repos
|
@@ -411,7 +407,14 @@ module DockerRegistry2
|
|
411
407
|
def headers(payload: nil, bearer_token: nil)
|
412
408
|
headers = {}
|
413
409
|
headers['Authorization'] = "Bearer #{bearer_token}" unless bearer_token.nil?
|
414
|
-
|
410
|
+
if payload.nil?
|
411
|
+
headers['Accept'] =
|
412
|
+
%w[application/vnd.docker.distribution.manifest.v2+json
|
413
|
+
application/vnd.docker.distribution.manifest.list.v2+json
|
414
|
+
application/vnd.oci.image.manifest.v1+json
|
415
|
+
application/vnd.oci.image.index.v1+json
|
416
|
+
application/json].join(',')
|
417
|
+
end
|
415
418
|
headers['Content-Type'] = 'application/vnd.docker.distribution.manifest.v2+json' unless payload.nil?
|
416
419
|
|
417
420
|
headers
|
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.14.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:
|
14
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|