docker_registry2 1.3.3 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e08cd68a840a81b4626ae46553d2a871e6b9359
4
- data.tar.gz: 96cf0475e4e42535fe3ec9859793d3ef2e09be6b
3
+ metadata.gz: 92661fd9c2f4fa3e3671b4f87e15fcb0d0c8ce0e
4
+ data.tar.gz: af29b48c6364a30603acec1c067581639b7f7ff1
5
5
  SHA512:
6
- metadata.gz: e17d3ec3c0c0c0ebe3e2e6641bb6b72ec2ed99d437b3bf49716b2af8709d9d105bb5ae935d57356fee612d4dc72d7d456d3e79bfe9e138eee3e749102216b2a5
7
- data.tar.gz: 997b7ccd4a8f68d75f10ddddc347b78c7a80b39ef9c10f2cc895179e27b6022621583cad0b8c4802d906088898798e2b35f0e9c579f8e021e6350de81d5e9a48
6
+ metadata.gz: 2ebb6b13cea085e56c507e2f14e494439f3bd89e08ac5aa12e643c7fddbe4854610d1e287763c737c73bbadf02f28385496097d0bef2dee31371ca93145566e0
7
+ data.tar.gz: 131718279f46b71d3140fd11a90e87beb596007234ee6f9d5fb51efe48bd0e401773f450e9f6ab2fc2609acb4ea3c0064b7a6610d885166536adb24742c302e1
data/README.md CHANGED
@@ -176,6 +176,13 @@ The following exceptions are thrown:
176
176
  * `RegistryAuthenticationException`: username and password are invalid
177
177
  * `RegistryAuthorizationException`: registry does not support tags using the given credentials, probably because the repository is private and the credentials provided do not have access
178
178
 
179
+ #### digest
180
+ ````ruby
181
+ digest = reg.digest("namespace/repo", "2.5.6")
182
+ ````
183
+
184
+ Returns the digest for the manifest represented by the tag of the given repository.
185
+
179
186
  #### pull
180
187
  ````ruby
181
188
  reg.pull("namespace/repo","2.5.6",dir)
@@ -6,7 +6,12 @@ require 'registry/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'docker_registry2'
8
8
  spec.version = DockerRegistry2::VERSION
9
- spec.authors = ['Avi Deitcher https://github.com/deitch', 'Jonathan Hurter https://github.com/johnsudaar', 'Dmitry Fleytman https://github.com/dmitryfleytman']
9
+ spec.authors = [
10
+ 'Avi Deitcher https://github.com/deitch',
11
+ 'Jonathan Hurter https://github.com/johnsudaar',
12
+ 'Dmitry Fleytman https://github.com/dmitryfleytman',
13
+ 'Grey Baker https://github.com/greysteil'
14
+ ]
10
15
  spec.summary = 'Docker v2 registry HTTP API client'
11
16
  spec.description = 'Docker v2 registry HTTP API client with support for token authentication'
12
17
  spec.homepage = 'https://github.com/deitch/docker_registry2'
@@ -22,4 +27,4 @@ Gem::Specification.new do |spec|
22
27
  spec.add_development_dependency 'rubocop', '>= 0.26.0'
23
28
 
24
29
  spec.add_dependency 'rest-client', '>= 1.8.0'
25
- end
30
+ end
@@ -77,6 +77,14 @@ class DockerRegistry2::Registry
77
77
  JSON.parse doget "/v2/#{repo}/manifests/#{tag}"
78
78
  end
79
79
 
80
+ def digest(repo, tag)
81
+ tag_path = "/v2/#{repo}/manifests/#{tag}"
82
+ dohead(tag_path).headers[:docker_content_digest]
83
+ rescue DockerRegistry2::InvalidMethod
84
+ # Pre-2.3.0 registries didn't support manifest HEAD requests
85
+ doget(tag_path).headers[:docker_content_digest]
86
+ end
87
+
80
88
  def rmtag(image, tag)
81
89
  # TODO: Need full response back. Rewrite other manifests() calls without JSON?
82
90
  reference = doget("/v2/#{image}/manifests/#{tag}").headers[:docker_content_digest]
@@ -1,3 +1,3 @@
1
1
  module DockerRegistry2
2
- VERSION = '1.3.3'
2
+ VERSION = '1.4.0'
3
3
  end
data/test/test.rb CHANGED
@@ -15,6 +15,9 @@ end
15
15
  # can we read the manifest?
16
16
  manifest = reg.manifest image, "latest"
17
17
 
18
+ # can we get the digest?
19
+ digest = reg.digest image, "latest"
20
+
18
21
  # can we pull an image?
19
22
  tmpdir = Dir.mktmpdir
20
23
  begin
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_registry2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avi Deitcher https://github.com/deitch
8
8
  - Jonathan Hurter https://github.com/johnsudaar
9
9
  - Dmitry Fleytman https://github.com/dmitryfleytman
10
+ - Grey Baker https://github.com/greysteil
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2017-12-19 00:00:00.000000000 Z
14
+ date: 2018-09-03 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: bundler