@@ -3,6 +3,9 @@ package validate
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "github.com/containers/image/v5/types"
7
+ "os"
8
+ "runtime"
6
9
"testing"
7
10
8
11
. "github.com/onsi/ginkgo/v2"
@@ -23,6 +26,30 @@ var _ = Describe("Check Catalog Consistency", func() {
23
26
images , err := utils .ParseImageRefsFromCatalog (catalogsPath )
24
27
Expect (err ).ToNot (HaveOccurred ())
25
28
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
+ }
26
53
27
54
for _ , url := range images {
28
55
name := utils .ImageNameFromRef (url )
@@ -31,7 +58,7 @@ var _ = Describe("Check Catalog Consistency", func() {
31
58
ctx := context .Background ()
32
59
By (fmt .Sprintf ("Validating image: %s" , url ))
33
60
34
- extractedImage , err := extract .UnpackImage (ctx , url , name )
61
+ extractedImage , err := extract .UnpackImage (ctx , url , name , sysCtx )
35
62
Expect (err ).ToNot (HaveOccurred ())
36
63
Expect (check .Check (ctx , extractedImage , check .AllChecks ())).To (Succeed ())
37
64
extractedImage .Cleanup ()
0 commit comments