From a02de84bf5b9bf3a3ca97a7b2c3037a4ea23d08d 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 61fc3d12b1..ff051cb0d8 100644 --- a/anchore_engine/clients/localanchore_standalone.py +++ b/anchore_engine/clients/localanchore_standalone.py @@ -1040,20 +1040,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,