Skip to content

Conversation

@wssaidong
Copy link

@wssaidong wssaidong commented Jan 9, 2026

Ⅰ. Describe what this PR did

修复了 make build-gateway-local 在 ARM64 架构下构建时仍然使用 AMD64 架构的问题。

问题背景:

  • 指定了 TARGET_ARCH=arm64 后,构建脚本仍然显示 Architectures: [linux/amd64]
  • Makefile 中的 build-golang-filter 目标硬编码了双架构构建
  • ./tools/docker 默认使用 --architectures linux/amd64

解决方案:
在 tools/hack/build-istio-image.sh 中添加了 DOCKER_ARCHITECTURES 环境变量的设置逻辑,根据 TARGET_ARCH 动态设置正确的架构:

  • TARGET_ARCH=arm64 → DOCKER_ARCHITECTURES=linux/arm64
  • 其他情况 → DOCKER_ARCHITECTURES=linux/amd64

并将该变量传递给 Docker 构建流程。


Ⅱ. Does this pull request fix one issue?

Fixes #3302


Ⅲ. Why don't you add test cases (unit test/integration test)?

这是一个构建脚本修复,修改的是 Shell 脚本的环境变量设置逻辑。修复可以通过实际执行 make build-gateway-local 命令并验证生成的镜像架构来验证,不需要额外的单元测试或集成测试。


Ⅳ. Describe how to verify it

验证步骤:

  1. 在 ARM64 环境下验证:
    TARGET_ARCH=arm64 make build-gateway-local
  2. 预期输出应包含 DOCKER_ARCHITECTURES=linux/arm64
  3. 在 AMD64 环境下验证:
    TARGET_ARCH=amd64 make build-gateway-local
  4. 预期输出应包含 DOCKER_ARCHITECTURES=linux/amd64
  5. 验证生成的镜像架构:
    docker inspect | grep Architecture
  6. 应与指定的 TARGET_ARCH 一致

Ⅴ. Special notes for reviews

  • 此修改仅影响 build-gateway-local 目标,不影响其他构建目标
  • DOCKER_ARCHITECTURES 变量在原构建脚本中已有使用,这里只是显式设置了它的��
  • 默认行为保持不变:未指定 TARGET_ARCH 时仍使用 linux/amd64


Ⅰ. Describe what this PR did

Fixed issue with make build-gateway-local still using AMD64 architecture when building under ARM64 architecture.

Problem background:

  • After specifying TARGET_ARCH=arm64, the build script still shows Architectures: [linux/amd64]
  • The build-golang-filter target in the Makefile hardcodes the dual-arch build
  • ./tools/docker uses --architectures linux/amd64 by default

Solution:
Added setting logic for the DOCKER_ARCHITECTURES environment variable in tools/hack/build-istio-image.sh to dynamically set the correct architecture based on TARGET_ARCH:

  • TARGET_ARCH=arm64 → DOCKER_ARCHITECTURES=linux/arm64
  • Other cases → DOCKER_ARCHITECTURES=linux/amd64

and pass this variable to the Docker build process.


Ⅱ. Does this pull request fix one issue?

Fixes #3302


Ⅲ. Why don't you add test cases (unit test/integration test)?

This is a build script fix that modifies the environment variable setting logic of the shell script. The fix can be verified by actually executing the make build-gateway-local command and verifying the resulting image architecture, no additional unit tests or integration tests are required.


Ⅳ. Describe how to verify it

Verification steps:

  1. Verify in ARM64 environment:
    TARGET_ARCH=arm64 make build-gateway-local
  2. Expected output should contain DOCKER_ARCHITECTURES=linux/arm64
  3. Verify in AMD64 environment:
    TARGET_ARCH=amd64 make build-gateway-local
  4. Expected output should contain DOCKER_ARCHITECTURES=linux/amd64
  5. Verify the generated image architecture:
    docker inspect | grep Architecture
  6. Should be consistent with the specified TARGET_ARCH

Ⅴ. Special notes for reviews

  • This modification only affects the build-gateway-local target and does not affect other build targets
  • The DOCKER_ARCHITECTURES variable has been used in the original build script, and its value is just explicitly set here.
  • Default behavior remains unchanged: linux/amd64 is still used when TARGET_ARCH is not specified

@CLAassistant
Copy link

CLAassistant commented Jan 9, 2026

CLA assistant check
All committers have signed the CLA.

指定了 TARGET_ARCH=arm64,但构建脚本仍然显示 Architectures: [linux/amd64]。因为 Makefile 中的 build-golang-filter 目标硬编码了两个架构的构建。但是 build-gateway-local 应该只构建当前架构。
./tools/docker 默认使用 --architectures linux/amd64
@wssaidong wssaidong force-pushed the bugfix/build-gateway-local branch from a4ad004 to 474efa2 Compare January 9, 2026 07:24
@CH3CHO
Copy link
Collaborator

CH3CHO commented Jan 10, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants