1
0
mirror of https://github.com/quay/quay.git synced 2025-04-18 10:44:06 +03:00

gc: Allow setting a deleted repo name's suffix (PROJQUAY-8408) (#3563)

Allows adding a suffix to uuid repo names to collect metrics
This commit is contained in:
Kenny Lee Sin Cheong 2025-01-13 14:21:47 -05:00 committed by GitHub
parent a4292cc2b4
commit b674c7cfc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -665,7 +665,7 @@ def set_repository_state(repo, state):
def mark_repository_for_deletion(
namespace_name, repository_name, repository_gc_queue, available_after=0
namespace_name, repository_name, repository_gc_queue, available_after=0, deleted_suffix=None
):
"""
Marks a repository for future deletion in the background.
@ -681,7 +681,11 @@ def mark_repository_for_deletion(
Star.delete().where(Star.repository == repo).execute()
# Change the name and state of the repository.
repo.name = str(uuid.uuid4())
deleted_name = str(uuid.uuid4())
if deleted_suffix is not None:
deleted_name = "_".join([deleted_name, str(deleted_suffix)])
repo.name = deleted_name
repo.state = RepositoryState.MARKED_FOR_DELETION
repo.save()