Merge branch 'sh-disable-registry-delete' into 'master'

Don't attempt to contact registry if it is disabled

See merge request gitlab-org/gitlab-ce!31553
This commit is contained in:
Thong Kuah 2019-08-07 10:18:13 +00:00
commit 55da8b2792
3 changed files with 18 additions and 0 deletions

View File

@ -173,6 +173,7 @@ module Projects
end
def remove_registry_tags
return true unless Gitlab.config.registry.enabled
return false unless remove_legacy_registry_tags
project.container_repositories.find_each do |container_repository|

View File

@ -0,0 +1,5 @@
---
title: Don't attempt to contact registry if it is disabled
merge_request: 31553
author:
type: fixed

View File

@ -241,6 +241,18 @@ describe Projects::DestroyService do
expect(destroy_project(project, user)).to be false
end
end
context 'when registry is disabled' do
before do
stub_container_registry_config(enabled: false)
end
it 'does not attempting to remove any tags' do
expect(Projects::ContainerRepository::DestroyService).not_to receive(:new)
destroy_project(project, user)
end
end
end
context 'when there are tags for legacy root repository' do