@@ -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,34 @@ 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
+ osChoice := os .Getenv ("OS_CHOICE" )
31
+
32
+ sysCtx := & types.SystemContext {}
33
+ if authPath != "" {
34
+ fmt .Println ("Using registry auth file:" , authPath )
35
+ sysCtx .AuthFilePath = authPath
36
+ }
37
+
38
+ // Force image resolution to Linux to avoid OS mismatch errors on macOS,
39
+ // like: "no image found for architecture 'arm64', OS 'darwin'".
40
+ //
41
+ // Setting OSChoice = "linux" ensures we always get a Linux image,
42
+ // even when running on macOS.
43
+ //
44
+ // This skips the full multi-arch index and gives us just one manifest.
45
+ // To check all supported architectures (e.g., amd64, arm64, ppc64le, s390x),
46
+ // we’d need to avoid setting OSChoice and inspect the full index manually.
47
+ //
48
+ // TODO: Update this to support checking all architectures.
49
+ // See: https://issues.redhat.com/browse/OPRUN-3793
50
+ if osChoice != "" {
51
+ fmt .Println ("Using OS choice:" , osChoice )
52
+ sysCtx .OSChoice = osChoice
53
+ } else if runtime .GOOS == "darwin" {
54
+ fmt .Println ("Detected macOS; forcing OS choice to 'linux'" )
55
+ sysCtx .OSChoice = "linux"
56
+ }
26
57
27
58
for _ , url := range images {
28
59
name := utils .ImageNameFromRef (url )
@@ -31,7 +62,7 @@ var _ = Describe("Check Catalog Consistency", func() {
31
62
ctx := context .Background ()
32
63
By (fmt .Sprintf ("Validating image: %s" , url ))
33
64
34
- extractedImage , err := extract .UnpackImage (ctx , url , name )
65
+ extractedImage , err := extract .UnpackImage (ctx , url , name , sysCtx )
35
66
Expect (err ).ToNot (HaveOccurred ())
36
67
Expect (check .Check (ctx , extractedImage , check .AllChecks ())).To (Succeed ())
37
68
extractedImage .Cleanup ()
0 commit comments