From 5f1224ba5ff5b705f9e7f64d76d0bf184641eab1 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 7 Aug 2025 13:51:55 +0000 Subject: [PATCH] feat: added info log when container image platform mismatched (#826) Refs https://github.com/nektos/act/pull/3225 --- * added info log when container image platform mismatched * inline image architecture comparison into ImageExistsLocally function as per review request (cherry picked from commit 77d31c96a9486553908fdeb1c3053015238d5a0a) - features - [PR](https://code.forgejo.org/forgejo/runner/pulls/826): feat: added info log when container image platform mismatched Co-authored-by: Ryan Fleet Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/826 Reviewed-by: Mathieu Fenniak Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- act/container/docker_images.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/act/container/docker_images.go b/act/container/docker_images.go index 484cc834..f1daff94 100644 --- a/act/container/docker_images.go +++ b/act/container/docker_images.go @@ -6,6 +6,7 @@ import ( "context" "fmt" + "code.forgejo.org/forgejo/runner/v9/act/common" cerrdefs "github.com/containerd/errdefs" "github.com/docker/docker/api/types/image" ) @@ -26,10 +27,15 @@ func ImageExistsLocally(ctx context.Context, imageName, platform string) (bool, return false, err } - if platform == "" || platform == "any" || fmt.Sprintf("%s/%s", inspectImage.Os, inspectImage.Architecture) == platform { + imagePlatform := fmt.Sprintf("%s/%s", inspectImage.Os, inspectImage.Architecture) + + if platform == "" || platform == "any" || imagePlatform == platform { return true, nil } + logger := common.Logger(ctx) + logger.Infof("image found but platform does not match: %s (image) != %s (platform)\n", imagePlatform, platform) + return false, nil }