Don't attempt to contact registry if it is disabled
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21679 moved the deletion of registry tags outside of a transaction, but introduced an issue where Sidekiq would attempt to contact the container registry during project destruction even if it were disabled. Relates to: * https://gitlab.com/charts/gitlab/issues/1455 * https://gitlab.com/gitlab-org/gitlab-ce/issues/45941
This commit is contained in:
parent
921611d19d
commit
35ce4820f2
3 changed files with 18 additions and 0 deletions
|
@ -173,6 +173,7 @@ module Projects
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_registry_tags
|
def remove_registry_tags
|
||||||
|
return true unless Gitlab.config.registry.enabled
|
||||||
return false unless remove_legacy_registry_tags
|
return false unless remove_legacy_registry_tags
|
||||||
|
|
||||||
project.container_repositories.find_each do |container_repository|
|
project.container_repositories.find_each do |container_repository|
|
||||||
|
|
5
changelogs/unreleased/sh-disable-registry-delete.yml
Normal file
5
changelogs/unreleased/sh-disable-registry-delete.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Don't attempt to contact registry if it is disabled
|
||||||
|
merge_request: 31553
|
||||||
|
author:
|
||||||
|
type: fixed
|
|
@ -241,6 +241,18 @@ describe Projects::DestroyService do
|
||||||
expect(destroy_project(project, user)).to be false
|
expect(destroy_project(project, user)).to be false
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
context 'when there are tags for legacy root repository' do
|
context 'when there are tags for legacy root repository' do
|
||||||
|
|
Loading…
Reference in a new issue