@@ -3,6 +3,9 @@ package validate
33import (
44 "context"
55 "fmt"
6+ "github.com/containers/image/v5/types"
7+ "os"
8+ "runtime"
69 "testing"
710
811 . "github.com/onsi/ginkgo/v2"
@@ -23,6 +26,30 @@ var _ = Describe("Check Catalog Consistency", func() {
2326 images , err := utils .ParseImageRefsFromCatalog (catalogsPath )
2427 Expect (err ).ToNot (HaveOccurred ())
2528 Expect (images ).ToNot (BeEmpty (), "no images found" )
29+ authPath := os .Getenv ("REGISTRY_AUTH_FILE" )
30+
31+ sysCtx := & types.SystemContext {}
32+ if authPath != "" {
33+ fmt .Println ("Using registry auth file:" , authPath )
34+ sysCtx .AuthFilePath = authPath
35+ }
36+
37+ // Force image resolution to Linux to avoid OS mismatch errors on macOS,
38+ // like: "no image found for architecture 'arm64', OS 'darwin'".
39+ //
40+ // Setting OSChoice = "linux" ensures we always get a Linux image,
41+ // even when running on macOS.
42+ //
43+ // This skips the full multi-arch index and gives us just one manifest.
44+ // To check all supported architectures (e.g., amd64, arm64, ppc64le, s390x),
45+ // we’d need to avoid setting OSChoice and inspect the full index manually.
46+ //
47+ // TODO: Update this to support checking all architectures.
48+ // See: https://issues.redhat.com/browse/OPRUN-3793
49+ if runtime .GOOS == "darwin" {
50+ fmt .Println ("Detected macOS; forcing OS choice to 'linux'" )
51+ sysCtx .OSChoice = "linux"
52+ }
2653
2754 for _ , url := range images {
2855 name := utils .ImageNameFromRef (url )
@@ -31,7 +58,7 @@ var _ = Describe("Check Catalog Consistency", func() {
3158 ctx := context .Background ()
3259 By (fmt .Sprintf ("Validating image: %s" , url ))
3360
34- extractedImage , err := extract .UnpackImage (ctx , url , name )
61+ extractedImage , err := extract .UnpackImage (ctx , url , name , sysCtx )
3562 Expect (err ).ToNot (HaveOccurred ())
3663 Expect (check .Check (ctx , extractedImage , check .AllChecks ())).To (Succeed ())
3764 extractedImage .Cleanup ()
0 commit comments