Commit 08396be6 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Rename ImageRegistry to ContainerRegistry

parent 1f77a1c6bd86
......@@ -5,10 +5,7 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
layout 'project'
def index
@tags = container_registry.tags
other_repository = container_registry.registry["gitlab/gitlab-test3"]
container_registry.copy_to(other_repository)
@tags = container_registry_repository.tags
end
def destroy
......@@ -21,8 +18,8 @@ def destroy
private
def container_registry
@container_registry ||= project.container_registry
def container_registry_repository
@container_registry_repository ||= project.container_registry_repository
end
def tag
......
......@@ -376,9 +376,11 @@ def repository
end
def container_registry
@registry_token ||= Jwt::DockerAuthenticationService.full_access_token(path_with_namespace)
@registry ||= ImageRegistry::Registry.new(Gitlab.config.registry.api_url, token: @registry_token)
@container_registry ||= ImageRegistry::Repository.new(@registry, path_with_namespace)
@container_registry_repository ||= begin
token = Jwt::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
registry = ContainerRegistry::Registry.new(Gitlab.config.registry.api_url, token: token)
registry[path_with_namespace]
end
end
def container_registry_url
......
module ImageRegistry
module ContainerRegistry
class Blob
attr_reader :repository, :config
......
require 'faraday'
require 'faraday_middleware'
module ImageRegistry
module ContainerRegistry
class Client
attr_accessor :uri
......
module ImageRegistry
module ContainerRegistry
class Config
attr_reader :tag, :blob, :data
......
module ImageRegistry
module ContainerRegistry
class Registry
attr_reader :uri, :client
def initialize(uri, options = {})
@uri = URI.parse(uri)
@client = ImageRegistry::Client.new(uri, options)
@client = ContainerRegistry::Client.new(uri, options)
end
def [](name)
ImageRegistry::Repository.new(self, name)
ContainerRegistry::Repository.new(self, name)
end
end
end
module ImageRegistry
module ContainerRegistry
class Repository
attr_reader :registry, :name
......@@ -11,7 +11,7 @@ def client
end
def [](tag)
ImageRegistry::Tag.new(self, tag)
ContainerRegistry::Tag.new(self, tag)
end
def manifest
......@@ -27,7 +27,7 @@ def tags
return @tags if defined?(@tags)
return [] unless manifest && manifest['tags']
@tags = manifest['tags'].map do |tag|
ImageRegistry::Tag.new(self, tag)
ContainerRegistry::Tag.new(self, tag)
end
@tags ||= []
end
......
module ImageRegistry
module ContainerRegistry
class Tag
attr_reader :repository, :name
......@@ -28,12 +28,12 @@ def digest
def config_blob
return @config_blob if defined?(@config_blob)
return unless manifest && manifest['config']
@config_blob = ImageRegistry::Blob.new(repository, manifest['config'])
@config_blob = ContainerRegistry::Blob.new(repository, manifest['config'])
end
def config
return unless config_blob
@config ||= ImageRegistry::Config.new(self, config_blob)
@config ||= ContainerRegistry::Config.new(self, config_blob)
end
def created_at
......@@ -45,7 +45,7 @@ def layers
return @layers if defined?(@layers)
return unless manifest
@layers = manifest['layers'].map do |layer|
ImageRegistry::Blob.new(repository, layer)
ContainerRegistry::Blob.new(repository, layer)
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment