citgm-smoke-nobuild osx11 fails to run x64 binary on arm
From https://ci.nodejs.org/job/citgm-smoker-nobuild/nodes=osx11/:
11:00:40 + curl -O https://nodejs.org/download/release/v20.10.0/node-v20.10.0-darwin-x64.tar.gz
...
11:00:49 /var/folders/1l/nz78mlkn2bx3p52l61053yqm0000gp/T/jenkins12141042854684170859.sh: line 34: /Users/iojs/build/workspace/citgm-smoker-nobuild/node/bin/node: Bad CPU type in executable
I also noticed that it works on test-nearform-macos11.0-arm64-1 - from speaking briefly to @richardlau it could be related to this NearForm machine having Rosetta 2 whereas the macstadium machines not (see trend).
This is confusing as tests will or will not run depending on which machine it happens to be scheduled on.
I would say that the actual bug is that we download the wrong binary.
This is a result of the job config that currently always picks "x64" for macOS:
case $nodes in
*-ppcle|*-ppc64le) OS=linux; ARCH=ppc64le; EXT=tar.gz;;
ubuntu*|debian*|fedora*|centos*|rhel*-x64) OS=linux; ARCH=x64; EXT=tar.gz;;
osx*) OS=darwin; ARCH=x64; EXT=tar.gz;;
*-s390x) OS=linux; ARCH=s390x; EXT=tar.gz;;
aix*) OS=aix; ARCH=ppc64; EXT=tar.gz;;
win*) OS=win; ARCH=x64; EXT=zip;;
esac
FWIW node-test-node-addon-api-new has something similar (maybe this logic should be shared in a shell script in this repository?) but there it always picks "arm64" for macOS 11 (which probably isn't right either):
case $nodes in
centos7*-ppcle) OS=linux; ARCH=ppc64le; EXT=tar.gz; OLD_KERNEL=yes;;
centos*-ppcle|*-ppc64le) OS=linux; ARCH=ppc64le; EXT=tar.gz;;
ubuntu18*-64) OS=linux; ARCH=x64; EXT=tar.gz; OLD_KERNEL=yes;;
ubuntu*-64|debian*-64|debian*-x64|fedora*|centos7*|rhel*-x64) OS=linux; ARCH=x64; EXT=tar.gz;;
ubuntu*-32|debian*-32|fedora*) OS=linux; ARCH=x86; EXT=tar.gz;;
osx11*) OS=darwin; ARCH=arm64; EXT=tar.gz;;
osx*) OS=darwin; ARCH=x64; EXT=tar.gz;;
rhel7*-s390x) OS=linux; ARCH=s390x; EXT=tar.gz OLD_KERNEL=yes;;
*-s390x) OS=linux; ARCH=s390x; EXT=tar.gz;;
aix*) OS=aix; ARCH=ppc64; EXT=tar.gz;;
win*) OS=win; ARCH=x64; EXT=zip;;
smart*) OS=sunos; ARCH=x64; EXT=tar.gz;;
esac
My suggestion would be to switch from using label osx11 for macOS 11 on arm64 to (new label) osx11-arm64. That would be easier to distinguish from the existing osx11-x64 label in the scripts.
e.g. we could then have
osx*-arm64) OS=darwin; ARCH=arm64; EXT=tar.gz;;
osx*-x64) OS=darwin; ARCH=x64; EXT=tar.gz;;