TVL depot development (mail to depot@tvl.su)
 help / color / mirror / code / Atom feed
* [PATCH] fix(nixery): strictly adhere to OCI image spec
@ 2024-02-14 13:35 Markus Rudy
  0 siblings, 0 replies; only message in thread
From: Markus Rudy @ 2024-02-14 13:35 UTC (permalink / raw)
  To: depot; +Cc: Markus Rudy, Paul Meyer

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

Signed-off-by: Markus Rudy <webmaster@burgerdev•de>
Co-authored-by: Paul Meyer <49727155+katexochen@users•noreply.github.com>

---
I'm sending a patch via email because the Github login on
https://auth.tvl.fyi does not work for me:

> Unexpected error when authenticating with identity provider

 tools/nixery/manifest/manifest.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/nixery/manifest/manifest.go b/tools/nixery/manifest/manifest.go
index d61514d2f..5638b576e 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"`
 }
 
-- 
2.43.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-14 13:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 13:35 [PATCH] fix(nixery): strictly adhere to OCI image spec Markus Rudy

Code repositories for project(s) associated with this public inbox

	https://code.tvl.fyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).