From 2844819d273b7c380c9264b3f3cea303082482fc Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 10 Feb 2023 23:18:29 -0800 Subject: [PATCH] set osversion in index descriptor from base image Signed-off-by: Tonis Tiigi --- frontend/dockerui/build.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/dockerui/build.go b/frontend/dockerui/build.go index 701daa18cd8a..8fc9bbbff11e 100644 --- a/frontend/dockerui/build.go +++ b/frontend/dockerui/build.go @@ -50,6 +50,17 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro if tp != nil { p = *tp } + + // in certain conditions we allow input platform to be extended from base image + if p.OS == "windows" && img.OS == p.OS { + if p.OSVersion == "" && img.OSVersion != "" { + p.OSVersion = img.OSVersion + } + if p.OSFeatures == nil && len(img.OSFeatures) > 0 { + p.OSFeatures = img.OSFeatures + } + } + p = platforms.Normalize(p) k := platforms.Format(p)