mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 21:57:54 +00:00
Add fail-safe to test the image architecture
Verify that the target image architecture matches what is expected according to the balena app architecture. Change-type: patch
This commit is contained in:
parent
c1b157971d
commit
1cf325d5c5
@ -133,6 +133,10 @@ COPY typings ./typings
|
||||
COPY src ./src
|
||||
COPY test ./test
|
||||
|
||||
# Fail-safe, check the architecture used by apk against the expected architecture
|
||||
# from the device type
|
||||
RUN APK_ARCH=$(./build-utils/apk-print-arch.sh); [ "$APK_ARCH" = "$ARCH" ] || (echo "Image architecture ($APK_ARCH) does not match the target architecture ($ARCH)" && exit 1)
|
||||
|
||||
# Run type checking and unit tests here
|
||||
# to prevent setting up a test environment that will
|
||||
# most likely fail.
|
||||
|
24
build-utils/apk-print-arch.sh
Executable file
24
build-utils/apk-print-arch.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# detect-arch.sh
|
||||
|
||||
apk_arch=$(apk --print-arch)
|
||||
case $apk_arch in
|
||||
x86_64)
|
||||
printf "amd64"
|
||||
;;
|
||||
aarch64)
|
||||
printf "aarch64"
|
||||
;;
|
||||
armv7)
|
||||
printf "armv7hf"
|
||||
;;
|
||||
armhf)
|
||||
printf "rpi"
|
||||
;;
|
||||
x86)
|
||||
printf "i386"
|
||||
;;
|
||||
*)
|
||||
printf "%s" "$apk_arch"
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user