Add a uniqueness hash to derived image storage to break caching over tags
This allows converted ACIs and squashed images to be unique based on the specified tag. Fixes #92
This commit is contained in:
parent
a33a70a419
commit
a43b741f1b
7 changed files with 119 additions and 40 deletions
|
@ -171,7 +171,8 @@ def _torrent_repo_verb(repo_image, tag, verb, **kwargs):
|
|||
|
||||
# Lookup an *existing* derived storage for the verb. If the verb's image storage doesn't exist,
|
||||
# we cannot create it here, so we 406.
|
||||
derived = model.image.find_derived_storage_for_image(repo_image, verb)
|
||||
derived = model.image.find_derived_storage_for_image(repo_image, verb,
|
||||
varying_metadata={'tag': tag})
|
||||
if not derived:
|
||||
abort(406)
|
||||
|
||||
|
@ -221,7 +222,8 @@ def _repo_verb_signature(namespace, repository, tag, verb, checker=None, **kwarg
|
|||
(repo_image, _, _) = result
|
||||
|
||||
# Lookup the derived image storage for the verb.
|
||||
derived = model.image.find_derived_storage_for_image(repo_image, verb)
|
||||
derived = model.image.find_derived_storage_for_image(repo_image, verb,
|
||||
varying_metadata={'tag': tag})
|
||||
if derived is None or derived.uploading:
|
||||
return make_response('', 202)
|
||||
|
||||
|
@ -253,7 +255,8 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
|
|||
|
||||
# Lookup/create the derived image storage for the verb and repo image.
|
||||
derived = model.image.find_or_create_derived_storage(repo_image, verb,
|
||||
storage.preferred_locations[0])
|
||||
storage.preferred_locations[0],
|
||||
varying_metadata={'tag': tag})
|
||||
|
||||
if not derived.uploading:
|
||||
logger.debug('Derived %s image %s exists in storage', verb, derived.uuid)
|
||||
|
|
Reference in a new issue