1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-31 18:30:58 +00:00

added info log when container image platform mismatched (#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)
This commit is contained in:
Ryan Fleet 2025-06-19 17:37:15 -04:00 committed by Earl Warren
parent e22d12ae53
commit 620f852889
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -8,6 +8,7 @@ import (
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/image"
"github.com/nektos/act/pkg/common"
)
// ImageExistsLocally returns a boolean indicating if an image with the
@ -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
}