about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorMarkus Rudy <webmaster@burgerdev.de>2024-02-14T13·35+0100
committerclbot <clbot@tvl.fyi>2024-02-22T16·56+0000
commitc461595b7f52697e2e7add79814880a285caeb34 (patch)
treecdfe832391e2768fdb87828951288582ff5908a1 /tools
parent017ad57433b4e0694cf7469c1a1d4f668be167e9 (diff)
fix(nixery): strictly adhere to OCI image spec r/7593
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 <webmaster@burgerdev.de>
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11012
Autosubmit: lukegb <lukegb@tvl.fyi>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tools')
-rw-r--r--tools/nixery/manifest/manifest.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/nixery/manifest/manifest.go b/tools/nixery/manifest/manifest.go
index d61514d2f62d..5638b576ebfd 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"`
 }