From dbfec7eda83ab694d0ff56bc9dccd164faed6a91 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Sat, 11 May 2024 16:08:17 +0200 Subject: [PATCH] CORS-3516: hack: do not execute cross-compiled binaries We cannot execute cross-compiled binaries, otherwise we get an error saying: ``` hack/build-cluster-api.sh: line 26: /go/src/github.com/openshift/installer/cluster-api/bin/darwin_amd64/kube-apiserver: cannot execute binary file: Exec format error ``` The check should be skipped in those cases. --- hack/build-cluster-api.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hack/build-cluster-api.sh b/hack/build-cluster-api.sh index c72c2a76a6..998e785236 100644 --- a/hack/build-cluster-api.sh +++ b/hack/build-cluster-api.sh @@ -23,6 +23,10 @@ copy_cluster_api_to_mirror() { sync_envtest() { if [ -f "${CLUSTER_API_BIN_DIR}/kube-apiserver" ]; then + if [ "$(go env GOOS)" != "$(go env GOHOSTOS)" ] || [ "$(go env GOARCH)" != "$(go env GOHOSTARCH)" ]; then + echo "Found cross-compiled artifact: skipping envtest binaries version check" + return + fi version=$("${CLUSTER_API_BIN_DIR}/kube-apiserver" --version | sed 's/Kubernetes //' || echo "v0.0.0") echo "Found envtest binaries with version: ${version}" if printf '%s\n%s' v${ENVTEST_K8S_VERSION} "${version}" | sort -V -C; then