Skip to content
Snippets Groups Projects
Commit 08396be6 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Rename ImageRegistry to ContainerRegistry

parent 565a5e36
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
@@ -21,8 +18,8 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
 
private
 
def container_registry
@container_registry ||= project.container_registry
def container_registry_repository
@container_registry_repository ||= project.container_registry_repository
end
 
def tag
Loading
Loading
Loading
Loading
@@ -376,9 +376,11 @@ class Project < ActiveRecord::Base
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
Loading
Loading
module ImageRegistry
module ContainerRegistry
class Blob
attr_reader :repository, :config
 
Loading
Loading
require 'faraday'
require 'faraday_middleware'
 
module ImageRegistry
module ContainerRegistry
class Client
attr_accessor :uri
 
Loading
Loading
module ImageRegistry
module ContainerRegistry
class Config
attr_reader :tag, :blob, :data
 
Loading
Loading
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
 
Loading
Loading
@@ -11,7 +11,7 @@ module ImageRegistry
end
 
def [](tag)
ImageRegistry::Tag.new(self, tag)
ContainerRegistry::Tag.new(self, tag)
end
 
def manifest
Loading
Loading
@@ -27,7 +27,7 @@ module ImageRegistry
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
Loading
Loading
module ImageRegistry
module ContainerRegistry
class Tag
attr_reader :repository, :name
 
Loading
Loading
@@ -28,12 +28,12 @@ module ImageRegistry
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
Loading
Loading
@@ -45,7 +45,7 @@ module ImageRegistry
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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment