diff --git a/docker-runner/common/entrypoint.sh b/docker-runner/common/entrypoint.sh index c74957f..802a4e8 100644 --- a/docker-runner/common/entrypoint.sh +++ b/docker-runner/common/entrypoint.sh @@ -98,13 +98,13 @@ if [ "$ENABLE_BUILDX" = "true" ]; then # 验证多架构支持 echo "Verifying multi-arch support..." - if docker run --rm arm64v8/alpine uname -m > /dev/null 2>&1; then + if docker run --rm --platform linux/arm64 alpine uname -m > /dev/null 2>&1; then echo " ✓ arm64 support verified" else echo " ⚠ arm64 verification failed" fi - if docker run --rm amd64/alpine uname -m > /dev/null 2>&1; then + if docker run --rm --platform linux/amd64 alpine uname -m > /dev/null 2>&1; then echo " ✓ amd64 support verified" else echo " ⚠ amd64 verification failed" diff --git a/tests/template_defaults_test.sh b/tests/template_defaults_test.sh index 5a5d2e4..8a4f9b5 100644 --- a/tests/template_defaults_test.sh +++ b/tests/template_defaults_test.sh @@ -199,6 +199,17 @@ test_stats_workflow_avoids_eval_find() { grep -q 'LANG_FIND_ARGS=()' "${file}" || fail "stats workflow should build language-specific find arguments via arrays" } +test_entrypoint_uses_platform_aware_multiarch_verification() { + local file + + file="${REPO_ROOT}/docker-runner/common/entrypoint.sh" + + grep -q 'docker run --rm --platform linux/arm64 alpine uname -m' "${file}" || fail "entrypoint.sh should verify arm64 support with an explicit platform" + grep -q 'docker run --rm --platform linux/amd64 alpine uname -m' "${file}" || fail "entrypoint.sh should verify amd64 support with an explicit platform" + ! rg -q 'docker run --rm arm64v8/alpine uname -m' "${file}" || fail "entrypoint.sh should not use arm64v8/alpine without an explicit platform" + ! rg -q 'docker run --rm amd64/alpine uname -m' "${file}" || fail "entrypoint.sh should not use amd64/alpine without an explicit platform" +} + test_preset_compose_uses_env_for_instance test_workflows_do_not_hardcode_company_server test_stats_workflow_uses_workflow_secret_consistently @@ -215,5 +226,6 @@ test_register_requires_python_yaml_path test_setup_requires_upgrade_helper test_entrypoint_uses_shared_buildx_builder_creation test_stats_workflow_avoids_eval_find +test_entrypoint_uses_platform_aware_multiarch_verification echo "template_defaults_test.sh: PASS"