mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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>
(cherry picked from commit 3cb933db9d
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8af2e62556
commit
95831246a2
1 changed files with 4 additions and 5 deletions
|
@ -22,11 +22,10 @@ import (
|
|||
|
||||
func emptyImageConfig() ([]byte, error) {
|
||||
pl := platforms.Normalize(platforms.DefaultSpec())
|
||||
img := ocispec.Image{
|
||||
Architecture: pl.Architecture,
|
||||
OS: pl.OS,
|
||||
Variant: pl.Variant,
|
||||
}
|
||||
img := ocispec.Image{}
|
||||
img.Architecture = pl.Architecture
|
||||
img.OS = pl.OS
|
||||
img.Variant = pl.Variant
|
||||
img.RootFS.Type = "layers"
|
||||
img.Config.WorkingDir = "/"
|
||||
img.Config.Env = []string{"PATH=" + system.DefaultPathEnv(pl.OS)}
|
||||
|
|
Loading…
Reference in a new issue