diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-09 22:27:06 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-09 22:27:06 +0300 |
commit | d7b91fb596e50411c0adb5aa8fb17341087f3f57 (patch) | |
tree | 8e85f359002e17af275ba8cf5ad21dc3ab12a4b6 /lib/container_registry | |
parent | 08396be619eee2e71c2f5f7aa27eea6f5ddf10ff (diff) | |
download | gitlab-ce-d7b91fb596e50411c0adb5aa8fb17341087f3f57.tar.gz |
Simplify Container Registry view implementation
Diffstat (limited to 'lib/container_registry')
-rw-r--r-- | lib/container_registry/blob.rb | 4 | ||||
-rw-r--r-- | lib/container_registry/registry.rb | 3 | ||||
-rw-r--r-- | lib/container_registry/repository.rb | 4 | ||||
-rw-r--r-- | lib/container_registry/tag.rb | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/lib/container_registry/blob.rb b/lib/container_registry/blob.rb index e0d9923f217..16e3f853418 100644 --- a/lib/container_registry/blob.rb +++ b/lib/container_registry/blob.rb @@ -11,6 +11,10 @@ module ContainerRegistry digest.present? end + def path + "#{repository.path}@#{digest}" + end + def digest config['digest'] end diff --git a/lib/container_registry/registry.rb b/lib/container_registry/registry.rb index f866862db22..a86ddb9326a 100644 --- a/lib/container_registry/registry.rb +++ b/lib/container_registry/registry.rb @@ -1,8 +1,9 @@ module ContainerRegistry class Registry - attr_reader :uri, :client + attr_reader :uri, :client, :path def initialize(uri, options = {}) + @path = uri || options[:path] @uri = URI.parse(uri) @client = ContainerRegistry::Client.new(uri, options) end diff --git a/lib/container_registry/repository.rb b/lib/container_registry/repository.rb index c930878d265..f01330f3648 100644 --- a/lib/container_registry/repository.rb +++ b/lib/container_registry/repository.rb @@ -10,6 +10,10 @@ module ContainerRegistry @client ||= registry.client end + def path + [registry.path, name].compact.join('/') + end + def [](tag) ContainerRegistry::Tag.new(self, tag) end diff --git a/lib/container_registry/tag.rb b/lib/container_registry/tag.rb index 324778bdf2a..14cee8be889 100644 --- a/lib/container_registry/tag.rb +++ b/lib/container_registry/tag.rb @@ -15,6 +15,10 @@ module ContainerRegistry @manifest = client.repository_manifest(repository.name, name) end + def path + "#{repository.path}:#{name}" + end + def [](key) return unless manifest manifest[key] |