From 79b393e4d18776017aeb3c07e9ae04b4e88da963 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Wed, 3 Dec 2025 10:23:35 +0000 Subject: [PATCH 1/2] Validate target platforms for built image After the image is built, make sure that each platform-specific image targets the correct platform by starting a container from each one and checking the output of `uname -m`. --- .github/workflows/build.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 72c0dcd..7944a91 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -44,6 +44,22 @@ jobs: outputs: type=image load: true tags: ${{ env.TEST_TAG }} + - name: Verify image's target platforms + run: | + amd64_uname="$(docker run --rm --platform linux/amd64 ${{ env.TEST_TAG }} /bin/bash -c 'uname -m')" + arm64_uname="$(docker run --rm --platform linux/arm64 ${{ env.TEST_TAG }} /bin/bash -c 'uname -m')" + rc=0 + if [ "$amd64_uname" != x86_64 ]; then + echo "Wrong machine hardware name for amd64 image: got $amd64_uname, expected x86_64" >&2 + rc=1 + fi + if [ "$arm64_uname" != aarch64 ]; then + echo "Wrong machine hardware name for arm64 image: got $arm64_uname, expected aarch64" >&2 + rc=1 + fi + if [ $rc -ne 0 ]; then + exit 1 + fi - name: Test cc-rules plugin run: | for platform in linux/amd64 linux/arm64; do From ce75b1ee7d304b6fe4e4097a64ba906f1270e9c9 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Wed, 3 Dec 2025 10:32:03 +0000 Subject: [PATCH 2/2] Simplify exit --- .github/workflows/build.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7944a91..7ac9a27 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,9 +57,7 @@ jobs: echo "Wrong machine hardware name for arm64 image: got $arm64_uname, expected aarch64" >&2 rc=1 fi - if [ $rc -ne 0 ]; then - exit 1 - fi + exit $rc - name: Test cc-rules plugin run: | for platform in linux/amd64 linux/arm64; do