stages/oci-archive: support for annotations

Add support for arbitrary manifest annotations: allow anything
with the exception of the `org.osbuild` and `org.opencontainer`
prefixes. The former is reserved by us, the latter by the OCI
image specification. The latter specifies a set of pre defined
keys, which are not yet supported by osbuild but will be in the
future, partly via more generic options (creation time).
This commit is contained in:
Christian Kellner 2021-05-12 18:41:29 +00:00
parent 2dfb6a224b
commit 65d831b2cb

View file

@ -16,6 +16,10 @@ as the `config` option for the "OCI Image Configuration" (see [2]),
except those that map to the "Go type map[string]struct{}", which are
represented as array of strings.
Manifest annotations can be included via the `annotation` options. Any
`key`, `value` pair is allowed, with the exception of the pre-defined
`org.osbuild` and `org.opencontainer` namespaces.
The final resulting tarball, aka a "orci-archive", can be imported via
podman[3] with `podman pull oci-archive:<archive>`.
@ -96,6 +100,15 @@ SCHEMA_2 = r"""
"type": "string"
}
}
},
"annotations": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^(?!org.osbuild|org.opencontainer).+": {
"type": "string"
}
}
}
}
},
@ -250,6 +263,10 @@ def create_oci_dir(inputs, output_dir, options):
"layers": []
}
annotations = options.get("annotations", {})
if annotations:
manifest["annotations"] = annotations
index = {
"schemaVersion": 2,
"manifests": []