INNER CODE UNIT · Python

inspect_image

varunsalian/debrify · tool/webdav_memory_stress/run.py:108

def inspect_image(reference):
    return json.loads(capture("docker", "image", "inspect", reference))[0]


def verified_fingerprint(image):
    labels = image["Config"].get("Labels") or {}
    try:
        fingerprint = json.loads(labels[PROVENANCE_LABEL])
    except (KeyError, TypeError, json.JSONDecodeError):
        raise SystemExit("Image lacks input provenance; rebuild without --skip-build")
    if (fingerprint != input_fingerprint()
            or labels.get(INPUT_LABEL) != fingerprint.get("inputDigest")):
        raise SystemExit(
            "The image does not match the current sources; rebuild without --skip-build"
        )
    # Reports use the image's copied inputs, even if the workspace changes after
    # this check. Never re-read live source files to describe the compiled image.
    return fingerprint

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…