Skip to content

Instantly share code, notes, and snippets.

@jonjohnsonjr
Created August 28, 2018 18:08
Show Gist options
  • Save jonjohnsonjr/dfa6d49a931955a01d7516cfcf68e049 to your computer and use it in GitHub Desktop.
Save jonjohnsonjr/dfa6d49a931955a01d7516cfcf68e049 to your computer and use it in GitHub Desktop.
# Putting annotations on the layer descriptor in the manifest.
# Pros:
# 1. Very intuitive, easy to parse/understand (by eye and in code).
# Cons:
# 1. If the target registry doesn't support OCI format annotations
# (probably most registries), this breaks.
# 2. If we are just copying a whole image over, this changes the manifest
# digest (not an issue, probably).
{
"schemaVersion": 2,
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 1497,
"digest": "sha256:e1ddd7948a1c31709a23cc5b7dfe96e55fc364f90e1cebcde0773a1b5a30dcda"
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"size": 733241,
"digest": "sha256:8c5a7da1afbc602695fcb2cd6445743cec5ff32053ea589ea9bd8773b7068185",
"annotations": {
"dev.knative.build.image.registry.mount": "index.docker.io/library/busybox"
}
}
]
}
# Putting annotations on the manifest descriptor in index.json.
# Pros:
# 1. Compatible with docker format images (thus all registries except quay).
# 2. Doesn't affect manifest digest, since annotation is external to manifest.
# Cons:
# 1. Need to define some grammar for specifying mapping from layers to source
# repositories (could sidestep that by just serializing JSON?).
# 2. Probably gets unwieldy with a lot of layers.
{
"schemaVersion": 2,
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 527,
"digest": "sha256:5e8e0509e829bb8f990249135a36e81a3ecbe94294e7a185cc14616e5fad96bd",
"annotations": {
"org.opencontainers.image.ref.name": "busybox",
"dev.knative.build.image.registry.mount": "sha256:8c5a7da1afbc602695fcb2cd6445743cec5ff32053ea589ea9bd8773b7068185=index.docker.io/library/busybox"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment