Commit 16e645c6 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Remove container_registry method from project class

parent 22fbdf743439
...@@ -405,20 +405,6 @@ def repository ...@@ -405,20 +405,6 @@ def repository
@repository ||= Repository.new(path_with_namespace, self) @repository ||= Repository.new(path_with_namespace, self)
end end
def container_registry
return unless Gitlab.config.registry.enabled
@container_registry ||= begin
token = Auth::ContainerRegistryAuthenticationService.full_access_token(project)
url = Gitlab.config.registry.api_url
host_port = Gitlab.config.registry.host_port
# TODO, move configuration vars into ContainerRegistry::Registry, clean
# this method up afterwards
ContainerRegistry::Registry.new(url, token: token, path: host_port)
end
end
def container_registry_url def container_registry_url
if Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{path_with_namespace.downcase}" "#{Gitlab.config.registry.host_port}/#{path_with_namespace.downcase}"
......
...@@ -1389,25 +1389,6 @@ def create_pipeline ...@@ -1389,25 +1389,6 @@ def create_pipeline
end end
end end
describe '#container_registry_path_with_namespace' do
let(:project) { create(:empty_project, path: 'PROJECT') }
subject { project.container_registry_path_with_namespace }
it { is_expected.not_to eq(project.path_with_namespace) }
it { is_expected.to eq(project.path_with_namespace.downcase) }
end
describe '#container_registry' do
let(:project) { create(:empty_project) }
before { stub_container_registry_config(enabled: true) }
subject { project.container_registry }
it { is_expected.not_to be_nil }
end
describe '#container_registry_url' do describe '#container_registry_url' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
...@@ -1417,10 +1398,8 @@ def create_pipeline ...@@ -1417,10 +1398,8 @@ def create_pipeline
context 'for enabled registry' do context 'for enabled registry' do
let(:registry_settings) do let(:registry_settings) do
{ { enabled: true,
enabled: true, host_port: 'example.com' }
host_port: 'example.com',
}
end end
it { is_expected.not_to be_nil } it { is_expected.not_to be_nil }
...@@ -1428,9 +1407,7 @@ def create_pipeline ...@@ -1428,9 +1407,7 @@ def create_pipeline
context 'for disabled registry' do context 'for disabled registry' do
let(:registry_settings) do let(:registry_settings) do
{ { enabled: false }
enabled: false
}
end end
it { is_expected.to be_nil } it { is_expected.to be_nil }
......
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