Skip to content

Commit fd3c486

Browse files
committed
Commonize uname -m results for aarch64 in docker runner
`uname -m` on Linux reports `aarch64`, but on MacOS reports `arm64`. Commonize this to `aarch64`. With this fix, it is now possible to run aarch64 CI docker images on Arm MacOS.
1 parent 5c84886 commit fd3c486

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/ci/docker/run.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ do
2727
shift
2828
done
2929

30+
machine="$(uname -m)"
31+
if [ "$machine" = "arm64" ]; then
32+
# MacOS reports "arm64" while Linux reports "aarch64". Commonize this.
33+
machine="aarch64"
34+
fi
35+
3036
script_dir="`dirname $script`"
31-
docker_dir="${script_dir}/host-$(uname -m)"
37+
docker_dir="${script_dir}/host-${machine}"
3238
ci_dir="`dirname $script_dir`"
3339
src_dir="`dirname $ci_dir`"
3440
root_dir="`dirname $src_dir`"
@@ -68,7 +74,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
6874

6975
# Include the architecture in the hash key, since our Linux CI does not
7076
# only run in x86_64 machines.
71-
uname -m >> $hash_key
77+
echo "$machine" >> $hash_key
7278

7379
# Include cache version. Can be used to manually bust the Docker cache.
7480
echo "2" >> $hash_key
@@ -178,7 +184,7 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
178184
build \
179185
--rm \
180186
-t rust-ci \
181-
-f "host-$(uname -m)/$image/Dockerfile" \
187+
-f "host-${machine}/$image/Dockerfile" \
182188
-
183189
else
184190
echo Invalid image: $image
@@ -201,7 +207,7 @@ else
201207
else
202208
continue
203209
fi
204-
echo "Note: the current host architecture is $(uname -m)"
210+
echo "Note: the current host architecture is $machine"
205211
done
206212

207213
exit 1

0 commit comments

Comments
 (0)