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

Rename ImageRegistry to ContainerRegistry

parent 565a5e36
...@@ -5,10 +5,7 @@ class Projects::ContainerRegistryController < Projects::ApplicationController ...@@ -5,10 +5,7 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
layout 'project' layout 'project'
def index def index
@tags = container_registry.tags @tags = container_registry_repository.tags
other_repository = container_registry.registry["gitlab/gitlab-test3"]
container_registry.copy_to(other_repository)
end end
def destroy def destroy
...@@ -21,8 +18,8 @@ class Projects::ContainerRegistryController < Projects::ApplicationController ...@@ -21,8 +18,8 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
private private
def container_registry def container_registry_repository
@container_registry ||= project.container_registry @container_registry_repository ||= project.container_registry_repository
end end
def tag def tag
......
...@@ -376,9 +376,11 @@ class Project < ActiveRecord::Base ...@@ -376,9 +376,11 @@ class Project < ActiveRecord::Base
end end
def container_registry def container_registry
@registry_token ||= Jwt::DockerAuthenticationService.full_access_token(path_with_namespace) @container_registry_repository ||= begin
@registry ||= ImageRegistry::Registry.new(Gitlab.config.registry.api_url, token: @registry_token) token = Jwt::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
@container_registry ||= ImageRegistry::Repository.new(@registry, path_with_namespace) registry = ContainerRegistry::Registry.new(Gitlab.config.registry.api_url, token: token)
registry[path_with_namespace]
end
end end
def container_registry_url def container_registry_url
......
module ImageRegistry module ContainerRegistry
class Blob class Blob
attr_reader :repository, :config attr_reader :repository, :config
......
require 'faraday' require 'faraday'
require 'faraday_middleware' require 'faraday_middleware'
module ImageRegistry module ContainerRegistry
class Client class Client
attr_accessor :uri attr_accessor :uri
......
module ImageRegistry module ContainerRegistry
class Config class Config
attr_reader :tag, :blob, :data attr_reader :tag, :blob, :data
......
module ImageRegistry module ContainerRegistry
class Registry class Registry
attr_reader :uri, :client attr_reader :uri, :client
def initialize(uri, options = {}) def initialize(uri, options = {})
@uri = URI.parse(uri) @uri = URI.parse(uri)
@client = ImageRegistry::Client.new(uri, options) @client = ContainerRegistry::Client.new(uri, options)
end end
def [](name) def [](name)
ImageRegistry::Repository.new(self, name) ContainerRegistry::Repository.new(self, name)
end end
end end
end end
module ImageRegistry module ContainerRegistry
class Repository class Repository
attr_reader :registry, :name attr_reader :registry, :name
...@@ -11,7 +11,7 @@ module ImageRegistry ...@@ -11,7 +11,7 @@ module ImageRegistry
end end
def [](tag) def [](tag)
ImageRegistry::Tag.new(self, tag) ContainerRegistry::Tag.new(self, tag)
end end
def manifest def manifest
...@@ -27,7 +27,7 @@ module ImageRegistry ...@@ -27,7 +27,7 @@ module ImageRegistry
return @tags if defined?(@tags) return @tags if defined?(@tags)
return [] unless manifest && manifest['tags'] return [] unless manifest && manifest['tags']
@tags = manifest['tags'].map do |tag| @tags = manifest['tags'].map do |tag|
ImageRegistry::Tag.new(self, tag) ContainerRegistry::Tag.new(self, tag)
end end
@tags ||= [] @tags ||= []
end end
......
module ImageRegistry module ContainerRegistry
class Tag class Tag
attr_reader :repository, :name attr_reader :repository, :name
...@@ -28,12 +28,12 @@ module ImageRegistry ...@@ -28,12 +28,12 @@ module ImageRegistry
def config_blob def config_blob
return @config_blob if defined?(@config_blob) return @config_blob if defined?(@config_blob)
return unless manifest && manifest['config'] return unless manifest && manifest['config']
@config_blob = ImageRegistry::Blob.new(repository, manifest['config']) @config_blob = ContainerRegistry::Blob.new(repository, manifest['config'])
end end
def config def config
return unless config_blob return unless config_blob
@config ||= ImageRegistry::Config.new(self, config_blob) @config ||= ContainerRegistry::Config.new(self, config_blob)
end end
def created_at def created_at
...@@ -45,7 +45,7 @@ module ImageRegistry ...@@ -45,7 +45,7 @@ module ImageRegistry
return @layers if defined?(@layers) return @layers if defined?(@layers)
return unless manifest return unless manifest
@layers = manifest['layers'].map do |layer| @layers = manifest['layers'].map do |layer|
ImageRegistry::Blob.new(repository, layer) ContainerRegistry::Blob.new(repository, layer)
end end
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