Disable GC for repositories with manifest lists
This is a temporary measure so we can roll V2_2 out for internal customer testing without having to worry about GC interacting oddly with it
This commit is contained in:
parent
e752a9a73f
commit
9994f0ae61
1 changed files with 10 additions and 1 deletions
|
@ -13,7 +13,7 @@ from data.database import (
|
||||||
RepositoryPermission, RepositoryActionCount, Role, RepositoryAuthorizedEmail,
|
RepositoryPermission, RepositoryActionCount, Role, RepositoryAuthorizedEmail,
|
||||||
DerivedStorageForImage, Label, db_for_update, get_epoch_timestamp,
|
DerivedStorageForImage, Label, db_for_update, get_epoch_timestamp,
|
||||||
db_random_func, db_concat_func, RepositorySearchScore, RepositoryKind, ApprTag,
|
db_random_func, db_concat_func, RepositorySearchScore, RepositoryKind, ApprTag,
|
||||||
ManifestLegacyImage, Manifest)
|
ManifestLegacyImage, Manifest, ManifestChild)
|
||||||
from data.text import prefix_search
|
from data.text import prefix_search
|
||||||
from util.itertoolrecipes import take
|
from util.itertoolrecipes import take
|
||||||
|
|
||||||
|
@ -207,6 +207,15 @@ def garbage_collect_repo(repo, is_purge=False):
|
||||||
"""
|
"""
|
||||||
logger.debug('Garbage collecting repository %s', repo.id)
|
logger.debug('Garbage collecting repository %s', repo.id)
|
||||||
|
|
||||||
|
# TODO(jschorr): Update GC for the new data model.
|
||||||
|
if not is_purge:
|
||||||
|
try:
|
||||||
|
# Skip any repos with manifest lists in them, for now.
|
||||||
|
ManifestChild.get(repository=repo)
|
||||||
|
return True
|
||||||
|
except ManifestChild.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
if is_purge:
|
if is_purge:
|
||||||
tag.purge_all_tags(repo)
|
tag.purge_all_tags(repo)
|
||||||
images_for_tags_removed = {i.id for i in Image.select().where(Image.repository == repo)}
|
images_for_tags_removed = {i.id for i in Image.select().where(Image.repository == repo)}
|
||||||
|
|
Reference in a new issue