From 9eeb9d4478cff547117fe61f52e4c1d2d25fef94 Mon Sep 17 00:00:00 2001 From: Timofey Kirillov Date: Wed, 22 Mar 2023 12:52:27 +0300 Subject: [PATCH] fix(multiarch): fix 'werf stage image' command panic related to multiarch refactor Signed-off-by: Timofey Kirillov --- cmd/werf/run/run.go | 1 + cmd/werf/stage/image/main.go | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/werf/run/run.go b/cmd/werf/run/run.go index b6e673a382..1e10b15902 100644 --- a/cmd/werf/run/run.go +++ b/cmd/werf/run/run.go @@ -410,6 +410,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken targetPlatforms = []string{containerBackend.GetDefaultPlatform()} } + // FIXME(multiarch): specify multiarch manifest here if err := c.FetchLastImageStage(ctx, targetPlatforms[0], imageName); err != nil { return err } diff --git a/cmd/werf/stage/image/main.go b/cmd/werf/stage/image/main.go index 077d0be2a5..90a3ce253d 100644 --- a/cmd/werf/stage/image/main.go +++ b/cmd/werf/stage/image/main.go @@ -207,8 +207,16 @@ func run(ctx context.Context, imageName string) error { return err } + targetPlatforms, err := c.GetTargetPlatforms() + if err != nil { + return fmt.Errorf("invalid target platforms: %w", err) + } + if len(targetPlatforms) == 0 { + targetPlatforms = []string{containerBackend.GetDefaultPlatform()} + } + // FIXME(multiarch): specify multiarch manifest here - fmt.Println(c.GetImageNameForLastImageStage("", imageName)) + fmt.Println(c.GetImageNameForLastImageStage(targetPlatforms[0], imageName)) return nil }); err != nil {