Skip to content

Commit

Permalink
fix(nixery): strictly adhere to OCI image spec
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: Paul Meyer <[email protected]>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11012
Autosubmit: lukegb <[email protected]>
Reviewed-by: lukegb <[email protected]>
Tested-by: BuildkiteCI
  • Loading branch information
2 people authored and clbot committed Feb 22, 2024
1 parent 0d880c6 commit eb845ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down

0 comments on commit eb845ef

Please sign in to comment.