Skip to content

Commit f3f0b57

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 f3f0b57

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ci/docker/run.sh

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

30+
# MacOS reports "arm64" while Linux reports "aarch64". Commonize this.
31+
machine="$(uname -m | sed 's/arm64/aarch64/')"
32+
3033
script_dir="`dirname $script`"
31-
docker_dir="${script_dir}/host-$(uname -m)"
34+
docker_dir="${script_dir}/host-${machine}"
3235
ci_dir="`dirname $script_dir`"
3336
src_dir="`dirname $ci_dir`"
3437
root_dir="`dirname $src_dir`"
@@ -68,7 +71,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
6871

6972
# Include the architecture in the hash key, since our Linux CI does not
7073
# only run in x86_64 machines.
71-
uname -m >> $hash_key
74+
echo "$machine" >> $hash_key
7275

7376
# Include cache version. Can be used to manually bust the Docker cache.
7477
echo "2" >> $hash_key
@@ -178,7 +181,7 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
178181
build \
179182
--rm \
180183
-t rust-ci \
181-
-f "host-$(uname -m)/$image/Dockerfile" \
184+
-f "host-${machine}/$image/Dockerfile" \
182185
-
183186
else
184187
echo Invalid image: $image
@@ -201,7 +204,7 @@ else
201204
else
202205
continue
203206
fi
204-
echo "Note: the current host architecture is $(uname -m)"
207+
echo "Note: the current host architecture is $machine"
205208
done
206209

207210
exit 1

0 commit comments

Comments
 (0)