Skip to content
Snippets Groups Projects
Commit 5fbeb73a authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Add method that returns a registry repository location

parent 3d1cade1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -23,6 +23,10 @@ class ContainerRepository < ActiveRecord::Base
@path ||= [project.full_path, name].select(&:present?).join('/')
end
 
def location
File.join(registry.path, path)
end
def tag(tag)
ContainerRegistry::Tag.new(self, tag)
end
Loading
Loading
Loading
Loading
@@ -91,6 +91,21 @@ describe ContainerRepository do
end
end
 
describe '#location' do
context 'when registry is running on a custom port' do
before do
stub_container_registry_config(enabled: true,
api_url: 'http://registry.gitlab:5000',
host_port: 'registry.gitlab:5000')
end
it 'returns a full location of the repository' do
expect(container_repository.location)
.to eq 'registry.gitlab:5000/group/test/my_image'
end
end
end
describe '#root_repository?' do
context 'when repository is a root repository' do
let(:repository) { create(:container_repository, :root) }
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