From a9beafbdba52701c3e0b01ad0c66ac6937932677 Mon Sep 17 00:00:00 2001 From: simohsieh Date: Tue, 31 Dec 2024 16:24:59 +0900 Subject: [PATCH] [Feature] Support ARM image for test (#2699) --- ray-operator/test/support/environment.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ray-operator/test/support/environment.go b/ray-operator/test/support/environment.go index 6c3764bec9..f20ef79e82 100644 --- a/ray-operator/test/support/environment.go +++ b/ray-operator/test/support/environment.go @@ -1,7 +1,10 @@ package support import ( + "fmt" "os" + "runtime" + "strings" ) const ( @@ -20,7 +23,15 @@ func GetRayVersion() string { } func GetRayImage() string { - return lookupEnvOrDefault(KuberayTestRayImage, RayImage) + rayImage := lookupEnvOrDefault(KuberayTestRayImage, RayImage) + // detect if we are running on arm64 machine, most likely apple silicon + // the os name is not checked as it also possible that it might be linux + // also check if the image does not have the `-aarch64` suffix + if runtime.GOARCH == "arm64" && !strings.HasSuffix(rayImage, "-aarch64") { + rayImage = rayImage + "-aarch64" + fmt.Printf("Modified Ray Image to: %s for ARM chips\n", rayImage) + } + return rayImage } func lookupEnvOrDefault(key, value string) string {