From f882a8bc0976762e376d723e6ac83ce1f4fc2e94 Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Wed, 22 May 2024 09:15:11 -0700 Subject: [PATCH] default os/arch for image export More defaulting is required to fix same issues as #354 where os/arch is required by buildkit --- codegen/builtin_fs.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/codegen/builtin_fs.go b/codegen/builtin_fs.go index ed2a545..6a82601 100644 --- a/codegen/builtin_fs.go +++ b/codegen/builtin_fs.go @@ -761,11 +761,20 @@ func (dp DockerPush) Call(ctx context.Context, cln *client.Client, val Value, op } exportFS.Image.ContainerConfig.Labels = exportFS.Image.Config.Labels - if exportFS.Image.OS == "" { + defaultPlat := DefaultPlatform(ctx) + switch { + case exportFS.Image.OS != "": // all good + case exportFS.Platform.OS != "": exportFS.Image.OS = exportFS.Platform.OS + default: + exportFS.Image.OS = defaultPlat.OS } - if exportFS.Image.Architecture == "" { + switch { + case exportFS.Image.Architecture != "": // all good + case exportFS.Platform.Architecture != "": exportFS.Image.Architecture = exportFS.Platform.Architecture + default: + exportFS.Image.Architecture = defaultPlat.Architecture } var dgst string