Use registry.port to construct the registry host

This commit is contained in:
Kamil Trzcinski 2016-05-16 09:48:39 -05:00
parent 38b63393bb
commit 623102d455
3 changed files with 6 additions and 4 deletions

View File

@ -332,15 +332,15 @@ class Project < ActiveRecord::Base
@container_registry_repository ||= begin
token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
url = Gitlab.config.registry.api_url
host = Gitlab.config.registry.host
registry = ContainerRegistry::Registry.new(url, token: token, path: host)
host_port = Gitlab.config.registry.host_port
registry = ContainerRegistry::Registry.new(url, token: token, path: host_port)
registry[path_with_namespace]
end
end
def container_registry_repository_url
if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host}/#{path_with_namespace}"
"#{Gitlab.config.registry.host_port}/#{path_with_namespace}"
end
end

View File

@ -16,7 +16,7 @@
To start using container images hosted on GitLab you first need to login:
%pre
%code
docker login #{Gitlab.config.registry.host}
docker login #{Gitlab.config.registry.host_port}
%br
Then you are free to create and upload a container image with build and push commands:
%pre

View File

@ -249,9 +249,11 @@ Settings.artifacts['max_size'] ||= 100 # in megabytes
Settings['registry'] ||= Settingslogic.new({})
Settings.registry['enabled'] ||= false
Settings.registry['host'] ||= "example.com"
Settings.registry['port'] ||= nil
Settings.registry['api_url'] ||= "http://localhost:5000/"
Settings.registry['key'] ||= nil
Settings.registry['issuer'] ||= nil
Settings.registry['host_port'] ||= [Settings.registry['host'], Settings.registry['port']].join(':')
#
# Git LFS