Skip to content

oci-artifact=true should also affect the attestations at the image index #3047

@polarathene

Description

@polarathene

Description

Original reference: moby/buildkit#5573 (comment)

When I opt-in to oci-artifact=true, the attestations are published as OCI 1.1 compliant, but the image index still has the Docker specific workaround instead of also being OCI 1.1 compliant? Should it not also have been adapted to OCI 1.1?

# NOTE: `--attest type=provenance,mode=min` is implicit by default
docker buildx build \
  --output type=image,push=true,oci-mediatypes=true,oci-artifact=true \
  --platform linux/amd64,linux/arm64 \
  --tag ghcr.io/polarathene/example:test \
  .

Actual Behaviour

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:6f81b18808466808136cd43e68a156f7a58937bd4e50edacce158ac5300cbce5",
      "size": 668,
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:c921e8c46326db1dbd537eaf8d9566408497e105d20a5f05baeaab09afff54b4",
      "size": 668,
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:6f1a7b24844a8ff6314eaa7fe99432de112731ef4e3a3811f58f07e062beea2d",
      "size": 914,
      "annotations": {
        "vnd.docker.reference.digest": "sha256:6f81b18808466808136cd43e68a156f7a58937bd4e50edacce158ac5300cbce5",
        "vnd.docker.reference.type": "attestation-manifest"
      },
      "platform": {
        "architecture": "unknown",
        "os": "unknown"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:47fe6f33b043ac8b3999f3d76b4d5cc46a8c4dcff4a4eef5f1a9e826ef96c988",
      "size": 914,
      "annotations": {
        "vnd.docker.reference.digest": "sha256:c921e8c46326db1dbd537eaf8d9566408497e105d20a5f05baeaab09afff54b4",
        "vnd.docker.reference.type": "attestation-manifest"
      },
      "platform": {
        "architecture": "unknown",
        "os": "unknown"
      }
    }
  ]
}

Expected Behaviour

Expected image index should no longer reference manifests for attestation artifacts in the manifests list:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:6f81b18808466808136cd43e68a156f7a58937bd4e50edacce158ac5300cbce5",
      "size": 668,
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "digest": "sha256:c921e8c46326db1dbd537eaf8d9566408497e105d20a5f05baeaab09afff54b4",
      "size": 668,
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    }
  ]
}

When publishing to a registry that is OCI v1.1 compliant with support for the Referrer API (or tag schema fallback), using oci-artifact=true publishes compatible OCI artifacts which can then be discovered.

This makes the non-compliant workaround specific to Docker redundant? The linked docs provide no context on compatible tooling that is reliant upon the data for artifact traversal/discovery (but lacks OCI v1.1 compatibility).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions