Use downcased path to container repository as this is expected path by Docker
This commit is contained in:
parent
5a377d20d5
commit
6e58e7ff7c
3 changed files with 18 additions and 3 deletions
|
@ -21,6 +21,7 @@ v 8.9.0 (unreleased)
|
|||
- Fix bug when sorting issues by milestone due date and filtering by two or more labels
|
||||
- Remove 'main language' feature
|
||||
- Pipelines can be canceled only when there are running builds
|
||||
- Use downcased path to container repository as this is expected path by Docker
|
||||
- Projects pending deletion will render a 404 page
|
||||
- Measure queue duration between gitlab-workhorse and Rails
|
||||
- Make authentication service for Container Registry to be compatible with < Docker 1.11
|
||||
|
|
|
@ -313,17 +313,17 @@ class Project < ActiveRecord::Base
|
|||
return unless Gitlab.config.registry.enabled
|
||||
|
||||
@container_registry_repository ||= begin
|
||||
token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
|
||||
token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace.downcase)
|
||||
url = Gitlab.config.registry.api_url
|
||||
host_port = Gitlab.config.registry.host_port
|
||||
registry = ContainerRegistry::Registry.new(url, token: token, path: host_port)
|
||||
registry.repository(path_with_namespace)
|
||||
registry.repository(path_with_namespace.downcase)
|
||||
end
|
||||
end
|
||||
|
||||
def container_registry_repository_url
|
||||
if Gitlab.config.registry.enabled
|
||||
"#{Gitlab.config.registry.host_port}/#{path_with_namespace}"
|
||||
"#{Gitlab.config.registry.host_port}/#{path_with_namespace.downcase}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -792,6 +792,13 @@ describe Project, models: true do
|
|||
subject { project.container_registry_repository }
|
||||
|
||||
it { is_expected.not_to be_nil }
|
||||
|
||||
context 'for uppercase project path' do
|
||||
let(:project) { create(:empty_project, path: 'PROJECT') }
|
||||
|
||||
it { expect(subject.path).not_to end_with(project.path) }
|
||||
it { expect(subject.path).to end_with(project.path.downcase) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#container_registry_repository_url' do
|
||||
|
@ -810,6 +817,13 @@ describe Project, models: true do
|
|||
end
|
||||
|
||||
it { is_expected.not_to be_nil }
|
||||
|
||||
context 'for uppercase project path' do
|
||||
let(:project) { create(:empty_project, path: 'PROJECT') }
|
||||
|
||||
it { is_expected.not_to end_with(project.path) }
|
||||
it { is_expected.to end_with(project.path.downcase) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'for disabled registry' do
|
||||
|
|
Loading…
Reference in a new issue