TVL depot development (mail to depot@tvl.su)
 help / color / mirror / code / Atom feed
From: Markus Rudy <webmaster@burgerdev•de>
To: depot@tvl.su
Cc: Markus Rudy <webmaster@burgerdev•de>,
	Paul Meyer <49727155+katexochen@users•noreply.github.com>
Subject: [PATCH] fix(nixery): strictly adhere to OCI image spec
Date: Wed, 14 Feb 2024 14:35:55 +0100	[thread overview]
Message-ID: <20240214133913.404172-1-webmaster@burgerdev.de> (raw)

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


                 reply	other threads:[~2024-02-14 13:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240214133913.404172-1-webmaster@burgerdev.de \
    --to=webmaster@burgerdev$(echo .)de \
    --cc=49727155+katexochen@users$(echo .)noreply.github.com \
    --cc=depot@tvl.su \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).