From c461595b7f52697e2e7add79814880a285caeb34 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Wed, 14 Feb 2024 14:35:55 +0100 Subject: fix(nixery): strictly adhere to OCI image spec nixery.dev uses the vnd.docker.container.image.v1 format, which is recognized by the OCI [1] and originally defined by Docker [2]. The config field in this image format, which this commit is about, is even portable between the Docker and OCI formats (the Docker Golang library embeds the OCI definition [3]). The attribute names in what's called ImageConfig in [3] are specified as PascalCase, which effectively means that the names Env and Cmd used by nixery need to be capitalized. The lowercase variant is not causing a lot of issues because most container tooling is written in Golang, which allows case-insensitive matches when deserializing JSON. Languages that parse strictly either miss the configuration values, or fail due to unknown attributes. This commit capitalizes Cmd and Env to accomodate strict parsers. [1]: https://github.com/opencontainers/image-spec/blob/365fa41/media-types.md?plain=1#L70 [2]: https://github.com/moby/moby/blob/v20.10.8/image/spec/v1.2.md#image-json-description [3]: https://github.com/opencontainers/image-spec/blob/365fa41/specs-go/v1/config.go#L24 Change-Id: Ibee597a64d36c008dea83a3b7a0d8e59b8287d0d Signed-off-by: Markus Rudy Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/11012 Autosubmit: lukegb Reviewed-by: lukegb Tested-by: BuildkiteCI --- tools/nixery/manifest/manifest.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/nixery/manifest/manifest.go b/tools/nixery/manifest/manifest.go index d61514d2f6..5638b576eb 100644 --- a/tools/nixery/manifest/manifest.go +++ b/tools/nixery/manifest/manifest.go @@ -54,8 +54,8 @@ type imageConfig struct { } `json:"rootfs"` Config struct { - Cmd []string `json:"cmd,omitempty"` - Env []string `json:"env,omitempty"` + Cmd []string `json:",omitempty"` + Env []string `json:",omitempty"` } `json:"config"` } -- cgit 1.4.1