Skip to content

fix: Remove alternative image architectures until we virtualize - #3336

Merged
kylecarbs merged 1 commit into
mainfrom
archimages
Aug 1, 2022
Merged

kylecarbs merged 1 commit into
mainfrom
archimages

Conversation

@kylecarbs

@kylecarbs kylecarbs commented Aug 1, 2022 •

Copy link
Copy Markdown
Member

With the addition of a command being executed inside the Docker build,
we could no longer build non-amd64 images on amd64. They will be added
back, but to allow for releases this temporarily removes them.

An issue tracking the addition has been added here: #3337

With the addition of a command being executed inside the Docker build,
we could no longer build non-amd64 images on amd64. They will be added
back, but to allow for releases this temporarily removes them.
@kylecarbs
kylecarbs requested a review from mafredri August 1, 2022 13:15
@kylecarbs kylecarbs self-assigned this Aug 1, 2022
@kylecarbs
kylecarbs marked this pull request as ready for review August 1, 2022 13:18
@kylecarbs
kylecarbs enabled auto-merge (squash) August 1, 2022 13:22
@kylecarbs
kylecarbs merged commit 00c5116 into main Aug 1, 2022
@kylecarbs
kylecarbs deleted the archimages branch August 1, 2022 13:37
deansheather added a commit that referenced this pull request Aug 1, 2022
deansheather added a commit that referenced this pull request Aug 1, 2022
* fix: don't use adduser and addgroup for docker images

* Revert "fix: Remove alternative image architectures until we virtualize (#3336)"

This reverts commit 00c5116.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean, proportional fix. One line, one commit, tracking issue linked. The binary/Docker image split is correctly scoped: Go cross-compilation (no container execution) is left intact while the Docker build loop (which now executes native commands) is narrowed. 4 of 8 reviewers found nothing to flag.

2 P2, 2 P3, 1 P4.

The headline finding is that docker/setup-qemu-action@v2 is a single workflow step that would preserve multi-arch Docker builds without any regression. The PR description says "until we virtualize," and QEMU user-mode emulation is exactly that virtualization. The RUN addgroup/adduser commands are trivial Alpine binaries that run correctly under QEMU. If QEMU is adopted, the comment/TODO findings resolve automatically since all architectures would be restored.

If the current approach stands, an inline TODO linking #3337 and updating the "for each architecture" comment would prevent confusion for future readers.

Go binary artifacts for armv7/arm64 continue to be built and released. Only Docker image users on arm64 (Apple Silicon, Graviton, ARM Kubernetes, Helm deployments using ghcr.io/coder/coder) are affected.

"Boring code gets silence. ♠" (Hisoka)


.github/workflows/release.yaml:122

P3 [DEREM-4] Single-arch manifest published as multi-arch is misleading.

build_docker_multiarch.sh is still called with only the amd64 image. It creates a manifest list containing one entry. Line 118 prints Skipping multi-arch docker builds due to dry-run. and this line says # build and push multi-arch manifest. With only amd64, neither "multi-arch" reference is accurate.

The manifest format implies multi-arch support that does not exist. Users on arm64 get a clear error (no matching manifest), so nothing silently breaks, but the manifest structure does not match reality.

(Pariston P3, Gon Nit)

🤖

🤖 This review was automatically generated with Coder Agents.

# build and (maybe) push Docker images for each architecture
images=()
for arch in amd64 armv7 arm64; do
for arch in amd64; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [DEREM-1] Architecture removal is unnecessary; the standard fix is adding QEMU emulation.

The CI runner is amd64. The Dockerfile now has RUN addgroup ... && adduser ... (added in #2746) that must execute on the target platform. Without QEMU registered in binfmt_misc, docker buildx build --platform linux/arm64 cannot execute these commands.

The standard GitHub Actions solution is one step:

- uses: docker/setup-qemu-action@v2

addgroup and adduser are small C binaries that run correctly under QEMU. No Go compilation, no complex toolchain, no heavy I/O. The overhead is negligible.

build_docker.sh already uses docker buildx build --platform "$arch" with an architecture map that includes arm64 and armv7. The infrastructure expects cross-platform builds. The only missing piece is the emulation layer on the runner.

What breaks without the fix: arm64 Docker users (Apple Silicon Macs, AWS Graviton, ARM Kubernetes clusters) get no matching manifest for linux/arm64 when pulling. The Helm chart defaults to ghcr.io/coder/coder, so Helm deployments on arm64 clusters also fail.

The tracking issue (#3337) mentions virtualization as the path forward, which is exactly what docker/setup-qemu-action provides. (Pariston)

🤖

# build and (maybe) push Docker images for each architecture
images=()
for arch in amd64 armv7 arm64; do
for arch in amd64; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3 [DEREM-2] Single-element loop with no inline comment explaining the temporary restriction or linking #3337.

for arch in amd64; do is a loop over one item. Without an inline marker, a reader must dig through git history to learn whether other values were removed intentionally or never existed. The loop scaffolding implies multiple values are expected but none are present.

Suggested fix:

# TODO(#3337): Re-add armv7 and arm64 once cross-arch Docker builds
# are virtualized. The Dockerfile RUN commands require matching arch.
for arch in amd64; do

(Leorio, Gon, Zoro)

🤖

@@ -102,7 +102,7 @@ jobs:

# build and (maybe) push Docker images for each architecture

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 [DEREM-3] Comment says "for each architecture" but only amd64 remains.

# build and (maybe) push Docker images for each architecture

"for each architecture" is factually inaccurate post-change. An operator reading this during release debugging may assume multi-arch builds are happening, then waste time before realizing only amd64 ships. The "(maybe) push" also restates the conditional --push visible on the next line.

If the temporary single-arch state is kept, update to reflect reality: # build and (maybe) push the Docker image or delete the comment. If DEREM-1 (QEMU) is adopted, the comment becomes accurate again.

(Gon P2, Leorio Nit)

🤖

# build and (maybe) push Docker images for each architecture
images=()
for arch in amd64 armv7 arm64; do
for arch in amd64; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P4 [DEREM-5] Commit message body does not identify the specific command or link the tracking issue.

The commit body says: "With the addition of a command being executed inside the Docker build, we could no longer build non-amd64 images on amd64." Which command? The addgroup/adduser RUN added in #2746. A reader doing git log or git blame gets a diagnosis that says "something changed" without naming the something. The PR description links #3337 but the commit body does not; commit bodies are the permanent record that survives PR UI changes.

(Leorio)

🤖

# build and (maybe) push Docker images for each architecture
images=()
for arch in amd64 armv7 arm64; do
for arch in amd64; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note [DEREM-6] Go binary cross-compilation still produces armv7/arm64 artifacts with no matching Docker images.

Lines 87 and 96 still build slim and matrix binaries for linux:amd64,armv7,arm64. Those binaries land in ./dist/ and get uploaded as release artifacts, so standalone binary users are unaffected. Only Docker users lose armv7/arm64. This split is intentional (binary builds are pure Go cross-compilation with no container execution), but the asymmetry is non-obvious to someone scanning the release artifacts.

(Pariston, Zoro)

🤖

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