diff --git a/.gitea/workflows/arm64-attach.yaml b/.gitea/workflows/arm64-attach.yaml index 8120641..2f41528 100644 --- a/.gitea/workflows/arm64-attach.yaml +++ b/.gitea/workflows/arm64-attach.yaml @@ -201,7 +201,13 @@ jobs: run: | set -euo pipefail want=$(docker run --rm --platform linux/amd64 --entrypoint php "$REPO@$AMD64" -r 'echo PHP_VERSION;') - got=$(docker run --rm --platform linux/arm64 --entrypoint php "$REPO@$ARM64_DIGEST" -r 'echo PHP_VERSION;') + # `docker run` of an arm64 image fails on this runner ("exec format error": no binfmt for the + # daemon), but BuildKit runs arm64 RUN steps under QEMU (that is how the image was built): + # run php in a throwaway build and export just the version file. + out=$(mktemp -d); ctx=$(mktemp -d) + printf 'FROM %s@%s AS src\nRUN php -r '"'"'echo PHP_VERSION;'"'"' > /pv\nFROM scratch\nCOPY --from=src /pv /pv\n' "$REPO" "$ARM64_DIGEST" | + docker buildx build --platform linux/arm64 --output "type=local,dest=$out" -f - "$ctx" + got=$(cat "$out/pv") echo "amd64 (existing tag) PHP ${want}; new arm64 PHP ${got}" [[ "$want" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]] || { echo "::error::cannot read the amd64 PHP version"; exit 1; } [ "$want" = "$got" ] || { echo "::error::PHP version differs between the existing amd64 (${want}) and the new arm64 (${got}); not attaching. The amd64 image needs a rebuild first."; exit 1; } diff --git a/scripts/tests/multiarch-workflow.test.py b/scripts/tests/multiarch-workflow.test.py index 14b019d..f0aba6a 100755 --- a/scripts/tests/multiarch-workflow.test.py +++ b/scripts/tests/multiarch-workflow.test.py @@ -417,8 +417,11 @@ class AttachWorkflow(unittest.TestCase): self.assertNotIn('linux/amd64', st) self.assertNotIn('Build amd64', self.job) - def test_nothing_but_the_script_writes_a_tag(self): - for bad in ('imagetools create', 'docker push', 'docker tag', '/cac:latest', '/cac-fpm:latest', 'ghcr.io', 'docker buildx build'): + for bad in ('imagetools create', 'docker push', 'docker tag', '/cac:latest', '/cac-fpm:latest', 'ghcr.io'): + self.assertNotIn(bad, self.job, bad) + self.assertEqual(self.job.count('docker buildx build'), 1) # only the local PHP-version probe + self.assertIn('type=local,dest=', self.job) + self.assertNotIn('--push', self.job) self.assertNotIn(bad, self.job, bad) self.assertEqual(self.job.count('scripts/attach-arm64-index.sh'), 2) # plan (read-only) + attach self.assertIn('--plan-only', step(self.job, 'Plan'))