Skip to content

Commit 3cb933d

Browse files
committed
Update uses of Image platform fields in OCI image-spec
The OCI image spec is considering to change the Image struct and embedding the Platform type (see opencontainers/image-spec#959) in the go implementation. Moby currently uses some struct-literals to propagate the platform fields, which will break once those changes in the OCI spec are merged. Ideally (once that change arrives) we would update the code to set the Platform information as a whole, instead of assigning related fields individually, but in some cases in the code, image platform information is only partially set (for example, OSVersion and OSFeatures are not preserved in all cases). This may be on purpose, so needs to be reviewed. This patch keeps the current behavior (assigning only specific fields), but removes the use of struct-literals to make the code compatible with the upcoming changes in the image-spec module. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 924edb9 commit 3cb933d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

builder/builder-next/exporter/writer.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ import (
2222

2323
func emptyImageConfig() ([]byte, error) {
2424
pl := platforms.Normalize(platforms.DefaultSpec())
25-
img := ocispec.Image{
26-
Architecture: pl.Architecture,
27-
OS: pl.OS,
28-
Variant: pl.Variant,
29-
}
25+
img := ocispec.Image{}
26+
img.Architecture = pl.Architecture
27+
img.OS = pl.OS
28+
img.Variant = pl.Variant
3029
img.RootFS.Type = "layers"
3130
img.Config.WorkingDir = "/"
3231
img.Config.Env = []string{"PATH=" + system.DefaultPathEnv(pl.OS)}

0 commit comments

Comments
 (0)