Skip to content

chore: use ARCH and remove TARGETARCH fallback#256

Merged
cheyang merged 1 commit intosgl-project:mainfrom
NoobDream2568:targetarch-fix
Apr 1, 2026
Merged

chore: use ARCH and remove TARGETARCH fallback#256
cheyang merged 1 commit intosgl-project:mainfrom
NoobDream2568:targetarch-fix

Conversation

@NoobDream2568
Copy link
Copy Markdown
Contributor

@NoobDream2568 NoobDream2568 commented Apr 1, 2026

Ⅰ. Motivation

Remove the default value from ARG TARGETARCH to align with docker buildx best practices. Buildx automatically injects the correct architecture during multi-arch builds, making a static default unnecessary and potentially conflicting.

To maintain compatibility for users running plain docker build . (which does not pass TARGETARCH), we now use a shell parameter expansion fallback: ARCH="${TARGETARCH:-amd64}". All subsequent steps reference ${ARCH} instead. This ensures reliable builds across both buildx workflows and standard docker build commands.

Ⅱ. Modifications

Ⅲ. Does this pull request fix one issue?

image The arm image incorrectly downloaded amd64 kubectl binary

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

Build an arm image and run. Check whether kubectl works fine.
image

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the Dockerfile for the crd-upgrade tool to change how the TARGETARCH argument is handled during the kubectl installation. The review feedback identifies a contradiction between the PR's stated goal and the implementation, which still includes a default fallback to amd64 via shell expansion, and suggests using the TARGETARCH variable directly for more idiomatic Dockerfile code.

Comment thread tools/crd-upgrade/Dockerfile
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@cheyang cheyang merged commit 95d30f8 into sgl-project:main Apr 1, 2026
9 checks passed
@NoobDream2568 NoobDream2568 deleted the targetarch-fix branch April 2, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants