docker_registry2 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +5 -0
  3. data/docker_registry2.gemspec +2 -2
  4. data/lib/registry/exceptions.rb +3 -0
  5. data/lib/registry/registry.rb +39 -18
  6. data/lib/registry/version.rb +1 -1
  7. metadata +8 -54
  8. data/.gitignore +0 -3
  9. data/.travis.yml +0 -8
  10. data/CHANGELOG.md +0 -29
  11. data/Gemfile +0 -3
  12. data/Makefile +0 -21
  13. data/get-gem-name.rb +0 -6
  14. data/test/registry/docker/registry/v2/blobs/sha256/05/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/data +0 -1
  15. data/test/registry/docker/registry/v2/blobs/sha256/5b/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/data +0 -0
  16. data/test/registry/docker/registry/v2/blobs/sha256/6d/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/data +0 -22
  17. data/test/registry/docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/data +0 -0
  18. data/test/registry/docker/registry/v2/blobs/sha256/a5/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/data +0 -16
  19. data/test/registry/docker/registry/v2/blobs/sha256/ce/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/data +0 -1
  20. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link +0 -1
  21. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link +0 -1
  22. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/link +0 -1
  23. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link +0 -1
  24. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/signatures/sha256/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/link +0 -1
  25. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/current/link +0 -1
  26. data/test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/index/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link +0 -1
  27. data/test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link +0 -1
  28. data/test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link +0 -1
  29. data/test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/revisions/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link +0 -1
  30. data/test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/current/link +0 -1
  31. data/test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/index/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link +0 -1
  32. data/test/test.rb +0 -30
  33. data/test.sh +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 268dd1aec5b4e778d6b1008be633575ac37d076d
4
- data.tar.gz: 79fbb9e626b10d41343897e757b8e803c77c4b49
2
+ SHA256:
3
+ metadata.gz: b9fd72dc1fe4e4402e0ee0351b1e67836689c54fba7d9ed41a87bf4e99e4ae79
4
+ data.tar.gz: a76ff1e8b07c7ef515756aaae656dcba022f4f903bb9c25c11a5546ced2fdeaf
5
5
  SHA512:
6
- metadata.gz: cce5e4063e67fb9c5a57cc3c9553f7d06ac8d7e43cb908fafcb005219b6582bd878744536857cc6e3874e520c4e772f92f82b0b74cf5c75bf3e77c91848a5c23
7
- data.tar.gz: e4aa32abced0d1c17133bd8189939a9efa9cdbb7de296ff67dbf31e1ec401972919b5a780292a259c4eb55223e7b94454fa5f6f26efb51053111977728d50c62
6
+ metadata.gz: b3001c73026f597029ba88318e99afaae6ac211da1a7870a700179734d8f87f8c391b6d4e2305783188e0164d3bf94b9a18ba6ecda258a2afd88a4fd3e7dae1b
7
+ data.tar.gz: 000f4d72b6c74030a0c0361e8e18daaf23d81619450296a65cb2a6759abeed275c6fa84c6ca4608d9f43d2ae69ca20935d97a9601693d17dcf06a144305dd931
data/README.md CHANGED
@@ -200,6 +200,8 @@ The following exceptions are thrown:
200
200
  * `RegistryAuthorizationException`: registry does not support tags or pull using the given credentials, probably because the repository is private and the credentials provided do not have access.
201
201
 
202
202
  #### push
203
+ > WARNING: Unimplemented
204
+
203
205
  ````ruby
204
206
  reg.push(manifest,dir)
205
207
  ````
@@ -230,8 +232,11 @@ The following exceptions are thrown:
230
232
 
231
233
  * `RegistryAuthenticationException`: username and password are invalid
232
234
  * `RegistryAuthorizationException`: registry does not support pushing the layers or uploading the manifest using the given credentials, probably because the repository is private and the credentials provided do not have access
235
+ * `RegisteryVersionException`: registry does not support the v2 API.
233
236
 
234
237
  #### copy
238
+ > WARNING: Unimplemented
239
+
235
240
  ````ruby
236
241
  reg.copy("namespace/repo","tag",newregistry,newrepo,newtag)
237
242
  ````
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.homepage = 'https://github.com/deitch/docker_registry2'
18
18
  spec.license = 'MIT'
19
19
 
20
- spec.files = `git ls-files -z`.split("\x0")
20
+ spec.files = %w{README.md} + Dir.glob("*.gemspec") + Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
21
21
  spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
22
22
  spec.test_files = spec.files.grep(/^(test|spec|features)\//)
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.6'
25
+ spec.add_development_dependency 'bundler'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
27
27
  spec.add_development_dependency 'rubocop', '>= 0.26.0'
28
28
 
@@ -14,6 +14,9 @@ module DockerRegistry2
14
14
 
15
15
  class RegistrySSLException < Exception
16
16
  end
17
+
18
+ class RegistryVersionException < Exception
19
+ end
17
20
 
18
21
  class ReauthenticatedException < Exception
19
22
  end
@@ -22,6 +22,10 @@ class DockerRegistry2::Registry
22
22
  return doreq "get", url
23
23
  end
24
24
 
25
+ def doput(url,payload=nil)
26
+ return doreq "put", url, nil, payload
27
+ end
28
+
25
29
  def dodelete(url)
26
30
  return doreq "delete", url
27
31
  end
@@ -153,6 +157,13 @@ class DockerRegistry2::Registry
153
157
  end
154
158
 
155
159
  def tag(repo,tag,newrepo,newtag)
160
+ manifest = manifest(repo, tag)
161
+
162
+ if manifest['schemaVersion'] == 2
163
+ doput "/v2/#{newrepo}/manifests/#{newtag}", manifest.to_json
164
+ else
165
+ raise DockerRegistry2::RegistryVersionException
166
+ end
156
167
  end
157
168
 
158
169
  def copy(repo,tag,newregistry,newrepo,newtag)
@@ -174,7 +185,7 @@ class DockerRegistry2::Registry
174
185
  end
175
186
 
176
187
  private
177
- def doreq(type,url,stream=nil)
188
+ def doreq(type,url,stream=nil,payload=nil)
178
189
  begin
179
190
  block = stream.nil? ? nil : proc { |response|
180
191
  response.read_body do |chunk|
@@ -184,10 +195,11 @@ class DockerRegistry2::Registry
184
195
  response = RestClient::Request.execute(
185
196
  method: type,
186
197
  url: @base_uri+url,
187
- headers: {Accept: 'application/vnd.docker.distribution.manifest.v2+json'},
198
+ headers: headers(payload: payload),
188
199
  block_response: block,
189
200
  open_timeout: @open_timeout,
190
- read_timeout: @read_timeout
201
+ read_timeout: @read_timeout,
202
+ payload: payload
191
203
  )
192
204
  rescue SocketError
193
205
  raise DockerRegistry2::RegistryUnknownException
@@ -198,9 +210,9 @@ class DockerRegistry2::Registry
198
210
  method = header.downcase.split(' ')[0]
199
211
  case method
200
212
  when 'basic'
201
- response = do_basic_req(type, url, stream)
213
+ response = do_basic_req(type, url, stream, payload)
202
214
  when 'bearer'
203
- response = do_bearer_req(type, url, header, stream)
215
+ response = do_bearer_req(type, url, header, stream, payload)
204
216
  else
205
217
  raise DockerRegistry2::RegistryUnknownException
206
218
  end
@@ -208,7 +220,7 @@ class DockerRegistry2::Registry
208
220
  return response
209
221
  end
210
222
 
211
- def do_basic_req(type, url, stream=nil)
223
+ def do_basic_req(type, url, stream=nil, payload=nil)
212
224
  begin
213
225
  block = stream.nil? ? nil : proc { |response|
214
226
  response.read_body do |chunk|
@@ -220,10 +232,11 @@ class DockerRegistry2::Registry
220
232
  url: @base_uri+url,
221
233
  user: @user,
222
234
  password: @password,
223
- headers: {Accept: 'application/vnd.docker.distribution.manifest.v2+json'},
235
+ headers: headers(payload: payload),
224
236
  block_response: block,
225
237
  open_timeout: @open_timeout,
226
- read_timeout: @read_timeout
238
+ read_timeout: @read_timeout,
239
+ payload: payload
227
240
  )
228
241
  rescue SocketError
229
242
  raise DockerRegistry2::RegistryUnknownException
@@ -237,7 +250,7 @@ class DockerRegistry2::Registry
237
250
  return response
238
251
  end
239
252
 
240
- def do_bearer_req(type, url, header, stream=false)
253
+ def do_bearer_req(type, url, header, stream=false, payload=nil)
241
254
  token = authenticate_bearer(header)
242
255
  begin
243
256
  block = stream.nil? ? nil : proc { |response|
@@ -248,10 +261,11 @@ class DockerRegistry2::Registry
248
261
  response = RestClient::Request.execute(
249
262
  method: type,
250
263
  url: @base_uri+url,
251
- headers: {Authorization: 'Bearer '+token, Accept: 'application/vnd.docker.distribution.manifest.v2+json'},
264
+ headers: headers(payload: payload, bearer_token: token),
252
265
  block_response: block,
253
266
  open_timeout: @open_timeout,
254
- read_timeout: @read_timeout
267
+ read_timeout: @read_timeout,
268
+ payload: payload
255
269
  )
256
270
  rescue SocketError
257
271
  raise DockerRegistry2::RegistryUnknownException
@@ -298,16 +312,23 @@ class DockerRegistry2::Registry
298
312
  def split_auth_header(header = '')
299
313
  h = Hash.new
300
314
  h = {params: {}}
301
- header.split(/[\s,]+/).each {|entry|
302
- p = entry.split('=')
303
- case p[0]
304
- when 'Bearer'
315
+ header.scan(/([\w]+)\=\"([^"]+)\"/) do |entry|
316
+ case entry[0]
305
317
  when 'realm'
306
- h[:realm] = p[1].gsub(/(^\"|\"$)/,'')
318
+ h[:realm] = entry[1]
307
319
  else
308
- h[:params][p[0]] = p[1].gsub(/(^\"|\"$)/,'')
320
+ h[:params][entry[0]] = entry[1]
309
321
  end
310
- }
322
+ end
311
323
  h
312
324
  end
325
+
326
+ def headers(payload: nil, bearer_token: nil)
327
+ headers={}
328
+ headers['Authorization']="Bearer #{bearer_token}" unless bearer_token.nil?
329
+ headers['Accept']='application/vnd.docker.distribution.manifest.v2+json' if payload.nil?
330
+ headers['Content-Type']='application/vnd.docker.distribution.manifest.v2+json' unless payload.nil?
331
+
332
+ headers
333
+ end
313
334
  end
@@ -1,3 +1,3 @@
1
1
  module DockerRegistry2
2
- VERSION = '1.5.0'
2
+ VERSION = '1.5.1'
3
3
  end
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avi Deitcher https://github.com/deitch
@@ -11,22 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-02-17 00:00:00.000000000 Z
14
+ date: 2019-05-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - "~>"
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: '1.6'
22
+ version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1.6'
29
+ version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -75,38 +75,12 @@ executables: []
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - ".gitignore"
79
- - ".travis.yml"
80
- - CHANGELOG.md
81
- - Gemfile
82
- - Makefile
83
78
  - README.md
84
79
  - docker_registry2.gemspec
85
- - get-gem-name.rb
86
80
  - lib/docker_registry2.rb
87
81
  - lib/registry/exceptions.rb
88
82
  - lib/registry/registry.rb
89
83
  - lib/registry/version.rb
90
- - test.sh
91
- - test/registry/docker/registry/v2/blobs/sha256/05/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/data
92
- - test/registry/docker/registry/v2/blobs/sha256/5b/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/data
93
- - test/registry/docker/registry/v2/blobs/sha256/6d/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/data
94
- - test/registry/docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/data
95
- - test/registry/docker/registry/v2/blobs/sha256/a5/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/data
96
- - test/registry/docker/registry/v2/blobs/sha256/ce/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/data
97
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link
98
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link
99
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/link
100
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link
101
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/signatures/sha256/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/link
102
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/current/link
103
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/index/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link
104
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link
105
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link
106
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/revisions/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link
107
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/current/link
108
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/index/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link
109
- - test/test.rb
110
84
  homepage: https://github.com/deitch/docker_registry2
111
85
  licenses:
112
86
  - MIT
@@ -126,28 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
100
  - !ruby/object:Gem::Version
127
101
  version: '0'
128
102
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.4.8
103
+ rubygems_version: 3.0.3
131
104
  signing_key:
132
105
  specification_version: 4
133
106
  summary: Docker v2 registry HTTP API client
134
- test_files:
135
- - test/registry/docker/registry/v2/blobs/sha256/05/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/data
136
- - test/registry/docker/registry/v2/blobs/sha256/5b/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/data
137
- - test/registry/docker/registry/v2/blobs/sha256/6d/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/data
138
- - test/registry/docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/data
139
- - test/registry/docker/registry/v2/blobs/sha256/a5/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/data
140
- - test/registry/docker/registry/v2/blobs/sha256/ce/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/data
141
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link
142
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link
143
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_layers/sha256/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/link
144
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link
145
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/revisions/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/signatures/sha256/ce7ce558987faf28ee4526d4d959ee327f4503428becafd3d40109887d54ec74/link
146
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/current/link
147
- - test/registry/docker/registry/v2/repositories/hello-world-v1/_manifests/tags/latest/index/sha256/6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca/link
148
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37/link
149
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_layers/sha256/5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9/link
150
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/revisions/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link
151
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/current/link
152
- - test/registry/docker/registry/v2/repositories/hello-world-v2/_manifests/tags/latest/index/sha256/a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988/link
153
- - test/test.rb
107
+ test_files: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- docker_registry2*.gem
2
- .bundle/*
3
- Gemfile.lock
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- sudo: required
2
-
3
- services:
4
- - docker
5
-
6
- script:
7
- - make build
8
- - make test
data/CHANGELOG.md DELETED
@@ -1,29 +0,0 @@
1
- ## v1.3.3, 18 December 2017
2
-
3
- - Use DockerRegistry2::NotFound in unauthenticated request calls
4
-
5
- ## v1.3.2, 15 December 2017
6
-
7
- - Use DockerRegistry2::NotFound in basic request calls (as well as bearer ones)
8
-
9
- ## v1.3.1, 15 December 2017
10
-
11
- - New DockerRegistry2::NotFound exceptions
12
-
13
- ## v1.3.0, 22 October 2017
14
-
15
- - Add basic tests
16
- - Add support for both v1 and v2 schemas thanks to https://github.com/lehn-etracker
17
-
18
- ## v1.2.0, 15 October 2017
19
-
20
- - Add shorter default timeouts. Previously, the RestClient default of 60 seconds
21
- was used for both open_timeout and read_timeout. Now, those values are set at
22
- 2 seconds and 5 seconds, respectively.
23
-
24
- ## v1.1.0, 13 October 2017
25
-
26
- - Move `ping` call from `DockerRegistry2::Registry.new` to
27
- `DockerRegistry2.connect`, to allow a registry to be initialized without a
28
- ping.
29
-
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
data/Makefile DELETED
@@ -1,21 +0,0 @@
1
- .PHONY: build test deploy all clean
2
-
3
- GEM ?= $(shell ruby ./get-gem-name.rb)
4
-
5
- all: deploy
6
-
7
- deploy: build
8
- gem push $(GEM)
9
-
10
- push: deploy
11
-
12
- build: $(GEM)
13
-
14
- $(GEM):
15
- gem build docker_registry2.gemspec
16
-
17
- clean:
18
- rm -rf docker_registry2*.gem
19
-
20
- test:
21
- ./test.sh
data/get-gem-name.rb DELETED
@@ -1,6 +0,0 @@
1
- #!ruby
2
-
3
- require "rubygems"
4
-
5
- spec = Gem::Specification::load("docker_registry2.gemspec")
6
- puts spec.name.to_s+'-'+spec.version.to_s+'.gem'
@@ -1 +0,0 @@
1
- {"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/hello"],"ArgsEscaped":true,"Image":"sha256:dcb41c36211f527a23dccf9178772996d641d7f5c140dae12ed29411d8ea5e65","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"6f86241dad28350cd4f8cc4e26f857757605e5ccd82dff35802cd9ffd0868274","container_config":{"Hostname":"6f86241dad28","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/hello\"]"],"ArgsEscaped":true,"Image":"sha256:dcb41c36211f527a23dccf9178772996d641d7f5c140dae12ed29411d8ea5e65","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2017-09-12T22:24:11.503356658Z","docker_version":"17.06.2-ce","history":[{"created":"2017-09-12T22:24:11.330149797Z","created_by":"/bin/sh -c #(nop) COPY file:b65349dad8105cbef74456e9c0c9da5d001e9eb2ade4b3c21e107909aee5b25a in / "},{"created":"2017-09-12T22:24:11.503356658Z","created_by":"/bin/sh -c #(nop) CMD [\"/hello\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:3a36971a9f14df69f90891bf24dc2b9ed9c2d20959b624eab41bbf126272a023"]}}
@@ -1,22 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "name": "hello-world-v1",
4
- "tag": "latest",
5
- "architecture": "amd64",
6
- "fsLayers": [
7
- {
8
- "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
9
- },
10
- {
11
- "blobSum": "sha256:5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9"
12
- }
13
- ],
14
- "history": [
15
- {
16
- "v1Compatibility": "{\"architecture\":\"amd64\",\"config\":{\"Hostname\":\"\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/hello\"],\"ArgsEscaped\":true,\"Image\":\"sha256:dcb41c36211f527a23dccf9178772996d641d7f5c140dae12ed29411d8ea5e65\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":null},\"container\":\"6f86241dad28350cd4f8cc4e26f857757605e5ccd82dff35802cd9ffd0868274\",\"container_config\":{\"Hostname\":\"6f86241dad28\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) \",\"CMD [\\\"/hello\\\"]\"],\"ArgsEscaped\":true,\"Image\":\"sha256:dcb41c36211f527a23dccf9178772996d641d7f5c140dae12ed29411d8ea5e65\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":{}},\"created\":\"2017-09-12T22:24:11.503356658Z\",\"docker_version\":\"17.06.2-ce\",\"id\":\"bef02f2f646789b5166d68ff91ad4b032b7b626912538d4ba26372d121072f36\",\"os\":\"linux\",\"parent\":\"3619f633e2e68c20001e347ea3b904ded56f5575beb9ac1fc3618d6d2b3a658d\",\"throwaway\":true}"
17
- },
18
- {
19
- "v1Compatibility": "{\"id\":\"3619f633e2e68c20001e347ea3b904ded56f5575beb9ac1fc3618d6d2b3a658d\",\"created\":\"2017-09-12T22:24:11.330149797Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) COPY file:b65349dad8105cbef74456e9c0c9da5d001e9eb2ade4b3c21e107909aee5b25a in / \"]}}"
20
- }
21
- ]
22
- }
@@ -1,16 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
4
- "config": {
5
- "mediaType": "application/vnd.docker.container.image.v1+json",
6
- "size": 1510,
7
- "digest": "sha256:05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37"
8
- },
9
- "layers": [
10
- {
11
- "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
12
- "size": 974,
13
- "digest": "sha256:5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9"
14
- }
15
- ]
16
- }
@@ -1 +0,0 @@
1
- {"header":{"jwk":{"crv":"P-256","kid":"HZFY:LV34:PG64:L5IU:KCXW:Z45P:CQIH:SS2U:7VB7:4F25:QFPL:UWYI","kty":"EC","x":"WgEr_lM3ItAdtGUe3bogKT3Q_99I_Pzu28OtkPOmpeA","y":"bYisRvE8gJPjO0nkiTXPZcNOPzNpwOj4Y56NnKF-Tys"},"alg":"ES256"},"signature":"_tUCImcmVEwpMNcxThg78lWDaou5KYtDSuBY6l5H50lGPV1faNm-btfMD9F1fvpecPb2kzEkfLyvbADkGTsW0w","protected":"eyJmb3JtYXRMZW5ndGgiOjIxNDAsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAxNy0xMC0yMlQxMToyOToxNVoifQ"}
@@ -1 +0,0 @@
1
- sha256:05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37
@@ -1 +0,0 @@
1
- sha256:5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9
@@ -1 +0,0 @@
1
- sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
@@ -1 +0,0 @@
1
- sha256:6d28b970d82cb05ce1aca12baddcd72b7034c7e771fdd97d0862672deb863fca
@@ -1 +0,0 @@
1
- sha256:05a3bd381fc2470695a35f230afefd7bf978b566253199c4ae5cc96fafa29b37
@@ -1 +0,0 @@
1
- sha256:5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9
@@ -1 +0,0 @@
1
- sha256:a5074d61e1e0175fb3a46e0bab46b1f764380ad00cac0e71d53bd4917d196988
data/test/test.rb DELETED
@@ -1,30 +0,0 @@
1
- #!ruby
2
- require 'tmpdir'
3
- require_relative '../lib/docker_registry2'
4
- version = ENV["VERSION"]
5
- reg = DockerRegistry2.connect "http://localhost:5000/"
6
-
7
- # do we have tags?
8
- image = "hello-world-"+version
9
- tags = reg.tags image
10
- if tags == nil || tags["name"] != image || tags["tags"] != ["latest"]
11
- abort "Bad tags"
12
- end
13
-
14
-
15
- # can we read the manifest?
16
- manifest = reg.manifest image, "latest"
17
-
18
- # can we get the digest?
19
- digest = reg.digest image, "latest"
20
-
21
- # can we pull an image?
22
- tmpdir = Dir.mktmpdir
23
- begin
24
- reg.pull image, "latest", tmpdir
25
- ensure
26
- FileUtils.remove_entry_secure tmpdir
27
- end
28
-
29
- # success
30
- exit
data/test.sh DELETED
@@ -1,34 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- cid=$(docker run -d -v $PWD/test/registry:/var/lib/registry -p 5000:5000 registry:2.6)
6
-
7
- # test a pull of each image - not a fancy start, but a good enough one
8
- bundle install
9
-
10
- set +e
11
- VERSION=v1 ruby ./test/test.rb
12
- success1=$?
13
- set -e
14
-
15
- set +e
16
- VERSION=v2 ruby ./test/test.rb
17
- success2=$?
18
- set -e
19
-
20
-
21
- docker kill $cid
22
- docker rm $cid
23
-
24
- if [ $success1 -ne 0 ]; then
25
- echo "Failed v1 test"
26
- fi
27
-
28
- if [ $success2 -ne 0 ]; then
29
- echo "Failed v2 test"
30
- fi
31
-
32
- if [ $success1 -ne 0 -o $success2 -ne 0 ]; then
33
- exit 1
34
- fi