about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2024-07-16 15:08:18 -0500
committerTrevor Gross <tmgross@umich.edu>2024-07-17 12:04:59 -0500
commitf3f0b572640e32297d58b4edf36ef69c62e47305 (patch)
tree3db5b41eceda1d1bd1b45f44008d9a0427de4415 /src/ci/docker
parent5c8488605624d67b272953bc21d41db60dbd5654 (diff)
downloadrust-f3f0b572640e32297d58b4edf36ef69c62e47305.tar.gz
rust-f3f0b572640e32297d58b4edf36ef69c62e47305.zip
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.
Diffstat (limited to 'src/ci/docker')
-rwxr-xr-xsrc/ci/docker/run.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index 40f42171411..fad4b5af095 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -27,8 +27,11 @@ do
   shift
 done
 
+# MacOS reports "arm64" while Linux reports "aarch64". Commonize this.
+machine="$(uname -m | sed 's/arm64/aarch64/')"
+
 script_dir="`dirname $script`"
-docker_dir="${script_dir}/host-$(uname -m)"
+docker_dir="${script_dir}/host-${machine}"
 ci_dir="`dirname $script_dir`"
 src_dir="`dirname $ci_dir`"
 root_dir="`dirname $src_dir`"
@@ -68,7 +71,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
 
     # Include the architecture in the hash key, since our Linux CI does not
     # only run in x86_64 machines.
-    uname -m >> $hash_key
+    echo "$machine" >> $hash_key
 
     # Include cache version. Can be used to manually bust the Docker cache.
     echo "2" >> $hash_key
@@ -178,7 +181,7 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
       build \
       --rm \
       -t rust-ci \
-      -f "host-$(uname -m)/$image/Dockerfile" \
+      -f "host-${machine}/$image/Dockerfile" \
       -
 else
     echo Invalid image: $image
@@ -201,7 +204,7 @@ else
         else
             continue
         fi
-        echo "Note: the current host architecture is $(uname -m)"
+        echo "Note: the current host architecture is $machine"
     done
 
     exit 1