Fix manifest UI page to properly show the layers of manifests and show manifest lists
This commit is contained in:
parent
8cd3740c69
commit
4106f5ce51
13 changed files with 162 additions and 89 deletions
|
@ -13,6 +13,9 @@ class RegistryModelProxy(object):
|
|||
self._model = oci_model if os.getenv('OCI_DATA_MODEL') == 'true' else pre_oci_model
|
||||
|
||||
def setup_split(self, v22_whitelist):
|
||||
if os.getenv('OCI_DATA_MODEL') == 'true':
|
||||
return
|
||||
|
||||
logger.info('===============================')
|
||||
logger.info('Enabling split registry model with namespace whitelist `%s`', v22_whitelist)
|
||||
logger.info('===============================')
|
||||
|
|
|
@ -207,7 +207,14 @@ class Manifest(datatype('Manifest', ['digest', 'media_type', 'manifest_bytes']))
|
|||
@property
|
||||
@requiresinput('legacy_image')
|
||||
def legacy_image(self, legacy_image):
|
||||
""" Returns the legacy Docker V1-style image for this manifest. Note that this
|
||||
""" Returns the legacy Docker V1-style image for this manifest.
|
||||
"""
|
||||
return legacy_image
|
||||
|
||||
@property
|
||||
@optionalinput('legacy_image')
|
||||
def legacy_image_if_present(self, legacy_image):
|
||||
""" Returns the legacy Docker V1-style image for this manifest. Note that this
|
||||
will be None for manifests that point to other manifests instead of images.
|
||||
"""
|
||||
return legacy_image
|
||||
|
|
|
@ -194,6 +194,14 @@ class RegistryDataInterface(object):
|
|||
def get_manifest_local_blobs(self, manifest, include_placements=False):
|
||||
""" Returns the set of local blobs for the given manifest or None if none. """
|
||||
|
||||
@abstractmethod
|
||||
def list_manifest_layers(self, manifest, storage, include_placements=False):
|
||||
""" Returns an *ordered list* of the layers found in the manifest, starting at the base
|
||||
and working towards the leaf, including the associated Blob and its placements
|
||||
(if specified). The layer information in `layer_info` will be of type
|
||||
`image.docker.types.ManifestImageLayer`.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def list_parsed_manifest_layers(self, repository_ref, parsed_manifest, storage,
|
||||
include_placements=False):
|
||||
|
|
|
@ -115,7 +115,7 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
legacy_image_id = database.ManifestLegacyImage.get(manifest=manifest).image.docker_image_id
|
||||
legacy_image = self.get_legacy_image(repository_ref, legacy_image_id, include_parents=True)
|
||||
except database.ManifestLegacyImage.DoesNotExist:
|
||||
return None
|
||||
pass
|
||||
|
||||
return Manifest.for_manifest(manifest, legacy_image)
|
||||
|
||||
|
@ -414,11 +414,7 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
legacy_image = oci.shared.get_legacy_image_for_manifest(manifest)
|
||||
return Manifest.for_manifest(manifest, LegacyImage.for_image(legacy_image))
|
||||
|
||||
def list_manifest_layers(self, manifest, include_placements=False):
|
||||
""" Returns an *ordered list* of the layers found in the manifest, starting at the base and
|
||||
working towards the leaf, including the associated Blob and its placements (if specified).
|
||||
Returns None if the manifest could not be parsed and validated.
|
||||
"""
|
||||
def list_manifest_layers(self, manifest, storage, include_placements=False):
|
||||
try:
|
||||
manifest_obj = database.Manifest.get(id=manifest._db_id)
|
||||
except database.Manifest.DoesNotExist:
|
||||
|
@ -431,8 +427,8 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
logger.exception('Could not parse and validate manifest `%s`', manifest._db_id)
|
||||
return None
|
||||
|
||||
return self._list_manifest_layers(manifest_obj.repository_id, parsed, include_placements,
|
||||
by_manifest=True)
|
||||
return self._list_manifest_layers(manifest_obj.repository_id, parsed, storage,
|
||||
include_placements, by_manifest=True)
|
||||
|
||||
def lookup_derived_image(self, manifest, verb, varying_metadata=None, include_placements=False):
|
||||
"""
|
||||
|
|
|
@ -479,11 +479,7 @@ class PreOCIModel(SharedModel, RegistryDataInterface):
|
|||
|
||||
return Manifest.for_tag_manifest(tag_manifest)
|
||||
|
||||
def list_manifest_layers(self, manifest, include_placements=False):
|
||||
""" Returns an *ordered list* of the layers found in the manifest, starting at the base and
|
||||
working towards the leaf, including the associated Blob and its placements (if specified).
|
||||
Returns None if the manifest could not be parsed and validated.
|
||||
"""
|
||||
def list_manifest_layers(self, manifest, storage, include_placements=False):
|
||||
try:
|
||||
tag_manifest = database.TagManifest.get(id=manifest._db_id)
|
||||
except database.TagManifest.DoesNotExist:
|
||||
|
@ -497,7 +493,7 @@ class PreOCIModel(SharedModel, RegistryDataInterface):
|
|||
return None
|
||||
|
||||
repo_ref = RepositoryReference.for_id(tag_manifest.tag.repository_id)
|
||||
return self.list_parsed_manifest_layers(repo_ref, parsed, include_placements)
|
||||
return self.list_parsed_manifest_layers(repo_ref, parsed, storage, include_placements)
|
||||
|
||||
def lookup_derived_image(self, manifest, verb, varying_metadata=None, include_placements=False):
|
||||
"""
|
||||
|
|
Reference in a new issue