Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better describe an Image Manifest as an artifact #1015

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ The following fields contain the primary properties that constitute a Descriptor
This REQUIRED property contains the media type of the referenced content.
Values MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2].

For the config descriptor of an [image manifest](manifest.md) with a subject field, this is the `artifactType` of that manifest.

The OCI image specification defines [several of its own MIME types](media-types.md) for resources defined in the specification.

- **`digest`** *string*
Expand Down
24 changes: 24 additions & 0 deletions manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,30 @@ Unlike the [image index](image-index.md), which contains information about a set
"digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736"
}
],
"annotations": {
"com.example.key1": "value1",
"com.example.key2": "value2"
}
}
```

*Example showing an artifact referenced by an image manifest:*
```json,title=Manifest&mediatype=application/vnd.oci.image.manifest.v1%2Bjson
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "image/gif",
"size": 3540101,
"digest": "sha256:725c49c527a83669901d00392768df9f653b1964a056c54232bc4c93003ddb48"
},
"layers": [
{
"mediaType": "application/octet-stream",
"size": 0,
"digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inverted from most examples I'm used to. With content, typically that is shipped in the layer and the config is only defined if there is metadata for the artifact. There is a push to define the "zero layer" artifact, but in those scenarios, the config is typically empty (or {} for registries expecting json).

Copy link
Author

@brackendawson brackendawson Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty config conveys no artifactType, according to the distribution spec, right?

My motivation to write this was that I couldn't initially tell how to set the artifactType of an Image Manifest.

How about giving the example of a zero size blob conveying artifactType and a single layer with some other media type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By empty config with {}, I'm referring to the blob content, not the descriptor. E.g.

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "config": {
    "mediaType": "application/spdx+json",
    "size": 2,
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"
  },
  "layers": [
    {
      "mediaType": "application/spdx+json",
      "size": 9210,
      "digest": "sha256:038b15a57207ce80b990a095b2a325188b005ccb6dc2704cb17dcf9cbfbaa1e9"
    }
  ],
  "annotations": {
    "org.opencontainers.artifact.created": "2023-02-04T21:27:04Z",
    "org.opencontainers.artifact.description": "SPDX JSON SBOM"
  },
  "subject": {
    "mediaType": "application/vnd.oci.image.manifest.v1+json",
    "size": 1024,
    "digest": "sha256:e7cdaad185f143527e454463f96f4eb5c49d9a24aea299fd00e4f136be34bb03"
  }
}

Here's an example with a helm chart I like, where they have a dedicated config media type:

{
  "schemaVersion": 2,
  "config": {
    "mediaType": "application/vnd.cncf.helm.config.v1+json",
    "digest": "sha256:23b5b19b695d822e7c1e6e1bd17d49ec768ab4b4f71aeb7d20f0b378f6257298",
    "size": 139
  },
  "layers": [
    {
      "mediaType": "application/vnd.cncf.helm.chart.content.v1.tar+gzip",
      "digest": "sha256:ae2ef52c768449e51474033431f5c974a03d89278f89de0ed24f8b08d24f8447",
      "size": 6589
    }
  ]
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated. Do you think we should add an annotation only example once we decide what the best recommendation regarding the layers field is?

"subject": {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7682,
Expand Down