Skip to content

feat(cloud): build deploy images for the cluster's CPU architecture - #556

Open
fabriciojs wants to merge 3 commits into
mainfrom
feat/dx-11-build-platform
Open

fabriciojs wants to merge 3 commits into
mainfrom
feat/dx-11-build-platform

Conversation

@fabriciojs

@fabriciojs fabriciojs commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

What changed and why

kool cloud deploy built every image for linux/amd64 unless --platform said otherwise, and nothing checked --platform against the cluster. On a Mac with Apple Silicon, a coding agent deployed --platform linux/arm64 to an amd64 cluster. The CLI accepted it and pushed the image, and the deploy failed about 5 minutes later with only a Go stack-trace fragment as the reason. Clusters you bring yourself can be arm64, so the right platform depends on the cluster.

  • The default build platform comes from the cluster. Kool.dev Cloud now returns the cluster's architectures and default platform in the deploy/create response (deploy.cluster.architectures, deploy.cluster.platform). With no --platform, the CLI builds for that platform and prints which one.
  • Old Kool.dev Cloud, or unknown cluster: when the response has no platform, the CLI builds linux/amd64, as before, and says it is falling back.
  • The platform is always sent. deploy/create gets platform: the one passed with --platform, or auto when the build follows the cluster's.
    • Kool.dev Cloud records it and refuses, before anything builds, a platform the cluster cannot run.
    • Kool.dev Cloud's answer governs, including when its checks are set to warn or off. The CLI does not refuse on its own.
  • --platform format. It is linux/<arch>[/<variant>], or a bare architecture (arm64 is read as linux/arm64, as docker does). A comma list is refused before anything is created: a deploy builds one platform.
  • Mixed-architecture clusters: when a service running the built image (imageFrom included) has no kubernetes.io/arch nodeSelector, the CLI says how to pin it.
  • Docs: kool cloud deploy --help (and the generated command reference), the "Building Images to Deploy" page and the kool-cloud-deploy skill now explain this. They include the FROM --platform=$BUILDPLATFORM builder pattern for JS builds that crash under QEMU (Next.js Turbopack, esbuild, Rolldown).

Not in scope, later work: native or server-side builds, so a Mac never has to emulate.

Release notes

  • --platform no longer defaults to linux/amd64: it defaults to the cluster's architecture, as Kool.dev Cloud reports it.
  • --platform is now validated before the deploy is created. A comma list (linux/amd64,linux/arm64) and anything that is not a Linux platform (windows/amd64) are refused. Docker accepted these before, so a CI job passing them will now stop with an error saying why. A bare architecture (arm64) still works.

Compatibility

  • New CLI + old Kool.dev Cloud: the response has no architecture, so the CLI builds linux/amd64 and says so. The platform field is ignored.
  • Old CLI + new Kool.dev Cloud: the CLI sends no platform, so nothing is refused and behaviour is unchanged.

How it was tested

  • go build ./..., go vet ./..., go test ./... (all pass)
  • New unit tests cover:
    • platform parsing, normalising and validation (bare architecture, comma list, aliases)
    • the field sent (auto or the platform)
    • platform resolution: cluster default, old-panel fallback, an override kept even when the panel lists other architectures
    • the mixed-cluster tip (shown only for unpinned services)
    • building and unpinned services, imageFrom included
    • the build loop: the resolved platform reaches the image build, and a failed build is reported to the deploy
    • the deploy/create request/response round trip
  • Regenerated docs/05-Commands-Reference/kool-cloud-deploy.md with go run -tags kooldocs docs.go.

🤖 Generated with Claude Code

kool cloud deploy built every image for linux/amd64 unless --platform said
otherwise, and nothing checked --platform against the cluster: an image of
the wrong architecture was pushed, and the deploy failed minutes later with
no useful reason.

- --platform now defaults to the platform Kool.dev Cloud returns for the
  cluster in the deploy/create response (linux/amd64 on the shared cloud,
  linux/amd64 or linux/arm64 on your own cluster)
- when it returns none (an older Kool.dev Cloud, or a cluster not inspected
  yet) the CLI builds linux/amd64 and says so
- an explicit --platform is sent to Kool.dev Cloud, which refuses one the
  cluster cannot run before anything builds; the CLI also refuses it when
  the response lists the cluster's architectures and it is not among them
- on a cluster mixing architectures, it says how to pin services with a
  kubernetes.io/arch nodeSelector
- help text, the command reference, the Building Images doc and the deploy
  skill explain it, with the FROM --platform=$BUILDPLATFORM builder pattern
  for JS builds that crash under QEMU

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 5, 2026 13:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Platform validation accepts malformed values, allowing them to reach deployment creation and potentially Docker instead of failing locally.

1 open issue
What changed in this PR

Makes kool cloud deploy select build platforms from the target cluster rather than always defaulting to amd64.

Changes:

  • Uses cluster-reported platforms, with an amd64 fallback for older servers.
  • Adds platform validation, compatibility checks, and mixed-cluster guidance.
  • Adds tests and documentation for architecture-aware builds and emulation workarounds.
File Description
skills/​kool-cloud-deploy/​SKILL.md Updates architecture and emulation guidance.
skills/​kool-cloud-deploy/​references/​nextjs.md Clarifies the runner architecture comment.
services/​cloud/​deployer.go Sends explicit platform overrides to the API.
services/​cloud/​api/​deploy_create.go Adds cluster architecture response fields.
services/​cloud/​api/​deploy_create_test.go Tests platform requests and response decoding.
docs/​05-Commands-Reference/​kool-cloud-deploy.md Updates generated help and platform defaults.
docs/​02-Kool-Cloud/​03-Building-Images-to-Deploy.md Documents platform selection and native build stages.
commands/​cloud_deploy.go Integrates platform selection into deployment.
commands/​cloud_deploy_platform.go Adds platform parsing, validation, and resolution.
commands/​cloud_deploy_platform_test.go Tests platform handling and build detection.

Review effort: Balanced

Comment thread commands/cloud_deploy_platform.go Resolved
fabriciojs and others added 2 commits December 5, 2026 10:19
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --platform accepts a bare architecture again (arm64 becomes linux/arm64,
  as docker reads it); a comma list is refused: a deploy builds one platform
- the platform is always sent to deploy/create: the one asked for, or
  "auto" when the build follows the cluster's, so Kool.dev Cloud records and
  checks what a defaulted build produces too
- the CLI no longer refuses a platform itself: Kool.dev Cloud's answer
  governs, including when its checks are set to warn or off
- the mixed-cluster tip shows only when a service running the built image
  (imageFrom included) is not pinned with a kubernetes.io/arch nodeSelector
- the architecture aliases match Kool.dev Cloud's (armv7, x64, i686, ...)
- the build loop is a tested method: the resolved platform reaches the
  image build, and a failed build is reported to the deploy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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