From 0616f23694f419ad0a1d98ab3ed2c05f8dcbc261 Mon Sep 17 00:00:00 2001 From: Tero Saarni Date: Fri, 28 May 2021 08:22:54 +0300 Subject: [PATCH] Use OCI manifest from skopeo copy for analysis If layers are not compressed on the registry, skopeo copy will compress them on the fly when executing "skopeo copy ... oci:dir". That causes disparity between image manifest that was previously fetched with "skopeo inspect", which had references to uncompressed layers. This change makes analysis rely on the OCI image manifest only. Fixes #1080 Signed-off-by: Tero Saarni --- anchore_engine/clients/localanchore_standalone.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/anchore_engine/clients/localanchore_standalone.py b/anchore_engine/clients/localanchore_standalone.py index d19e3f2ae..4401b729c 100644 --- a/anchore_engine/clients/localanchore_standalone.py +++ b/anchore_engine/clients/localanchore_standalone.py @@ -1047,20 +1047,16 @@ def analyze_image( rc = anchore_engine.clients.skopeo_wrapper.copy_image_from_docker_archive( image_source_meta, staging_dirs["copydir"] ) - - manifest = get_manifest_from_staging(staging_dirs) - - manifest_data = json.loads(manifest) - - if image_source != "docker-archive": + else: rc = retrying_pull_image( staging_dirs, pullstring, registry_creds=registry_creds, - manifest=manifest, - parent_manifest=parent_manifest, ) + manifest = get_manifest_from_staging(staging_dirs) + manifest_data = json.loads(manifest) + if manifest_data["schemaVersion"] == 1: ( docker_history,