diff --git a/certification/internal/engine/engine.go b/certification/internal/engine/engine.go index e3eb34b1..20ad39af 100644 --- a/certification/internal/engine/engine.go +++ b/certification/internal/engine/engine.go @@ -13,6 +13,7 @@ import ( "path" "path/filepath" "regexp" + goruntime "runtime" "sort" "strings" "sync" @@ -28,8 +29,10 @@ import ( "github.com/google/go-containerregistry/pkg/crane" "github.com/google/go-containerregistry/pkg/name" + cranev1 "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/cache" "github.com/google/go-containerregistry/pkg/v1/remote" + log "github.com/sirupsen/logrus" ) @@ -76,6 +79,10 @@ func (c *CraneEngine) ExecuteChecks(ctx context.Context) error { authn.WithDockerConfig(c.Config.DockerConfig()), ), ), + crane.WithPlatform(&cranev1.Platform{ + OS: "linux", + Architecture: goruntime.GOARCH, + }), retryOnceAfter(5 * time.Second), } diff --git a/certification/internal/policy/container/has_unique_tag.go b/certification/internal/policy/container/has_unique_tag.go index 19288374..5f9475ff 100644 --- a/certification/internal/policy/container/has_unique_tag.go +++ b/certification/internal/policy/container/has_unique_tag.go @@ -3,12 +3,14 @@ package container import ( "context" "fmt" + goruntime "runtime" "strings" "github.com/redhat-openshift-ecosystem/openshift-preflight/certification" "github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/authn" "github.com/google/go-containerregistry/pkg/crane" + cranev1 "github.com/google/go-containerregistry/pkg/v1" ) var _ certification.Check = &hasUniqueTagCheck{} @@ -57,6 +59,10 @@ func (p *hasUniqueTagCheck) getDataToValidate(ctx context.Context, image string) options := []crane.Option{ crane.WithContext(ctx), crane.WithAuthFromKeychain(authn.PreflightKeychain(authn.WithDockerConfig(p.dockercfg))), + crane.WithPlatform(&cranev1.Platform{ + OS: "linux", + Architecture: goruntime.GOARCH, + }), } return crane.ListTags(image, options...) diff --git a/certification/runtime/assets.go b/certification/runtime/assets.go index 98f80c1b..8156fe4c 100644 --- a/certification/runtime/assets.go +++ b/certification/runtime/assets.go @@ -3,11 +3,13 @@ package runtime import ( "context" "fmt" + goruntime "runtime" "strings" "github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/authn" "github.com/google/go-containerregistry/pkg/crane" + cranev1 "github.com/google/go-containerregistry/pkg/v1" log "github.com/sirupsen/logrus" ) @@ -26,6 +28,10 @@ func imageList(ctx context.Context) []string { options := []crane.Option{ crane.WithContext(ctx), crane.WithAuthFromKeychain(authn.PreflightKeychain()), + crane.WithPlatform(&cranev1.Platform{ + OS: "linux", + Architecture: goruntime.GOARCH, + }), } imageList := make([]string, 0, len(images))