Skip to content

Include architecture and/or image digest in JSON output #1107

@cbandy

Description

@cbandy

Is your feature request related to a problem? Please describe.

When scanning an image index, JSON reports do not indicate which architecture the results are about. I can see the image architectures and digests in log messages but not in JSON.

$ preflight-1.7.2 check container 'registry.access.redhat.com/ubi9/buildah:latest' > preflight.json
level=info msg="certification library version" version="1.7.2 <commit: f1bfa27d3f87bc9b95936aaeb4edc6a92a268645>"
level=info msg="running checks for registry.access.redhat.com/ubi9/buildah:latest for platform amd64"
level=info msg="target image" image="registry.access.redhat.com/ubi9/buildah:latest"

level=info msg="This image's tag latest will be paired with digest sha256:0e0d263a42c4971c43290489181dfc58ed723a0797400abe2002cdb219e4bb84 once this image has been published…

level=info msg="running checks for registry.access.redhat.com/ubi9/buildah:latest for platform arm64"
level=info msg="target image" image="registry.access.redhat.com/ubi9/buildah:latest"

level=info msg="This image's tag latest will be paired with digest sha256:73312575856fc4d64b33c757ac3ec0807cb5b3c0527c05b5284832b4e9219791 once this image has been published…


$ cat preflight.json
{
    "image": "registry.access.redhat.com/ubi9/buildah:latest",
    "passed": …,
    "test_library": { … },
    "results": { … }
}
{
    "image": "registry.access.redhat.com/ubi9/buildah:latest",
    "passed": …,
    "test_library": { … },
    "results": { … }
}
{
    "image": "registry.access.redhat.com/ubi9/buildah:latest",
    "passed": …,
    "test_library": { … },
    "results": { … }
}

Describe the solution you'd like.

I'd like more details in JSON about the image that was scanned.

I'm deep in image contents all the time, so I think I might like a platform field in the JSON that looks like the OCI index field:

{
  "image": "registry.access.redhat.com/ubi9/buildah:latest",
  "platform": {
    "os": "linux",
    "architecture": "amd64"
  },
  "results": {}
}
{
  "image": "registry.access.redhat.com/ubi9/buildah:latest",
  "platform": {
    "os": "linux",
    "architecture": "arm64"
  },
  "results": {}
}

I could infer the platform from a digest field, so that's a second possible solution. Lots of other things can be inferred from the digest, so perhaps it could obviate other feature requests.

{
  "image": "registry.access.redhat.com/ubi9/buildah:latest",
  "digest": "sha256:0e0d263a42c4971c43290489181dfc58ed723a0797400abe2002cdb219e4bb84",
  "results": {}
}
{
  "image": "registry.access.redhat.com/ubi9/buildah:latest",
  "digest": "sha256:73312575856fc4d64b33c757ac3ec0807cb5b3c0527c05b5284832b4e9219791",
  "results": {}
}
$ skopeo inspect --raw docker://registry.access.redhat.com/ubi9/buildah:latest
{
    "manifests": [
        {
            "digest": "sha256:0e0d263a42c4971c43290489181dfc58ed723a0797400abe2002cdb219e4bb84",
            "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "platform": {
                "architecture": "amd64",
                "os": "linux"
            },
            "size": 595
        },
        {
            "digest": "sha256:73312575856fc4d64b33c757ac3ec0807cb5b3c0527c05b5284832b4e9219791",
            "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "platform": {
                "architecture": "arm64",
                "os": "linux"
            },
            "size": 595
        },

Describe alternatives you've considered.

Perhaps the image field should have a digest instead of a tag. This change is potentially disruptive.

{
  "image": "registry.access.redhat.com/ubi9/buildah@sha256:0e0d263a42c4971c43290489181dfc58ed723a0797400abe2002cdb219e4bb84",
  "results": {}
}
{
  "image": "registry.access.redhat.com/ubi9/buildah@sha256:73312575856fc4d64b33c757ac3ec0807cb5b3c0527c05b5284832b4e9219791",
  "results": {}
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions