docker_registry2 1.14.0 → 1.16.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/exceptions.rb +9 -9
- data/lib/registry/registry.rb +25 -20
- 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: bf700e5c43bdbd9216827748cc2010b4f4a2ab6fc83615478589e24200a17e80
|
4
|
+
data.tar.gz: 10dc661ce6689a5a4009d64483c4e26c78bb8dae08412058e4a565cc79169c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2f999e780c186e6e19c23698984f2897ddda4e312641cbea94fb1f6e873053c14a55b7fe6422508537eb6e9c3eb023086030156a3ec2214a828f886e956ddba
|
7
|
+
data.tar.gz: 33166c81576a0f368ce6326c1d62726524e8143eeb9e9c579433efa172e87dea00f2a469359ff87238750b7595af7508798c090dcfd68a1d0e5c02192ed134db
|
data/lib/registry/exceptions.rb
CHANGED
@@ -4,30 +4,30 @@ module DockerRegistry2
|
|
4
4
|
class Exception < RuntimeError
|
5
5
|
end
|
6
6
|
|
7
|
-
class RegistryAuthenticationException <
|
7
|
+
class RegistryAuthenticationException < DockerRegistry2::Exception
|
8
8
|
end
|
9
9
|
|
10
|
-
class RegistryAuthorizationException <
|
10
|
+
class RegistryAuthorizationException < DockerRegistry2::Exception
|
11
11
|
end
|
12
12
|
|
13
|
-
class RegistryUnknownException <
|
13
|
+
class RegistryUnknownException < DockerRegistry2::Exception
|
14
14
|
end
|
15
15
|
|
16
|
-
class RegistrySSLException <
|
16
|
+
class RegistrySSLException < DockerRegistry2::Exception
|
17
17
|
end
|
18
18
|
|
19
|
-
class RegistryVersionException <
|
19
|
+
class RegistryVersionException < DockerRegistry2::Exception
|
20
20
|
end
|
21
21
|
|
22
|
-
class ReauthenticatedException <
|
22
|
+
class ReauthenticatedException < DockerRegistry2::Exception
|
23
23
|
end
|
24
24
|
|
25
|
-
class UnknownRegistryException <
|
25
|
+
class UnknownRegistryException < DockerRegistry2::Exception
|
26
26
|
end
|
27
27
|
|
28
|
-
class NotFound <
|
28
|
+
class NotFound < DockerRegistry2::Exception
|
29
29
|
end
|
30
30
|
|
31
|
-
class InvalidMethod <
|
31
|
+
class InvalidMethod < DockerRegistry2::Exception
|
32
32
|
end
|
33
33
|
end
|
data/lib/registry/registry.rb
CHANGED
@@ -17,7 +17,7 @@ module DockerRegistry2
|
|
17
17
|
# @option options [Hash] :http_options Extra options for RestClient::Request.execute.
|
18
18
|
def initialize(uri, options = {})
|
19
19
|
@uri = URI.parse(uri)
|
20
|
-
@base_uri = "#{@uri.scheme}://#{@uri.host}:#{@uri.port}"
|
20
|
+
@base_uri = "#{@uri.scheme}://#{@uri.host}:#{@uri.port}#{@uri.path}"
|
21
21
|
@user = options[:user]
|
22
22
|
@password = options[:password]
|
23
23
|
@http_options = options[:http_options] || {}
|
@@ -83,21 +83,9 @@ module DockerRegistry2
|
|
83
83
|
|
84
84
|
# do we include the hashes?
|
85
85
|
if withHashes
|
86
|
-
useGet = false
|
87
86
|
resp['hashes'] = {}
|
88
87
|
resp['tags'].each do |tag|
|
89
|
-
|
90
|
-
head = doget "/v2/#{repo}/manifests/#{tag}"
|
91
|
-
else
|
92
|
-
begin
|
93
|
-
head = dohead "/v2/#{repo}/manifests/#{tag}"
|
94
|
-
rescue DockerRegistry2::InvalidMethod
|
95
|
-
# in case we are in a registry pre-2.3.0, which did not support manifest HEAD
|
96
|
-
useGet = true
|
97
|
-
head = doget "/v2/#{repo}/manifests/#{tag}"
|
98
|
-
end
|
99
|
-
end
|
100
|
-
resp['hashes'][tag] = head.headers[:docker_content_digest]
|
88
|
+
resp['hashes'][tag] = digest(repo, tag)
|
101
89
|
end
|
102
90
|
end
|
103
91
|
|
@@ -138,12 +126,29 @@ module DockerRegistry2
|
|
138
126
|
end
|
139
127
|
end
|
140
128
|
|
141
|
-
def digest(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
#
|
146
|
-
|
129
|
+
def digest(image, tag, architecture = nil, os = nil, variant = nil)
|
130
|
+
manifest = manifest(image, tag)
|
131
|
+
parsed_manifest = JSON.parse(manifest.body)
|
132
|
+
|
133
|
+
# Multi-arch images
|
134
|
+
if parsed_manifest.key?('manifests')
|
135
|
+
manifests = parsed_manifest['manifests']
|
136
|
+
|
137
|
+
return manifests if architecture.nil? || os.nil?
|
138
|
+
|
139
|
+
manifests.each do |entry|
|
140
|
+
if !variant.nil?
|
141
|
+
return entry['digest'] if entry['platform']['architecture'] == architecture && entry['platform']['os'] == os && entry['platform']['variant'] == variant
|
142
|
+
elsif entry['platform']['architecture'] == architecture && entry['platform']['os'] == os
|
143
|
+
return entry['digest']
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
raise DockerRegistry2::NotFound, "No matches found for the image=#{image} tag=#{tag} os=#{os} architecture=#{architecture}"
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
manifest.headers[:docker_content_digest]
|
147
152
|
end
|
148
153
|
|
149
154
|
def rmtag(image, tag)
|
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.16.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: 2023-
|
14
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|