diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/project.rb | 6 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 14 |
3 files changed, 18 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 848aaa8506e..d1cde40c1c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index c1d9bae44c9..13376da9948 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 6c1b0393682..65f06b51794 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -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 |