Skip to content

feat: emit build recipe when CLI owns the docker build (#63) - #64

Merged
antoinetoussaint-byte merged 2 commits into
mainfrom
issue-63-adopt-cli-owned-build-migrate-build-rpc-to
Aug 23, 2026
Merged

feat: emit build recipe when CLI owns the docker build (#63)#64
antoinetoussaint-byte merged 2 commits into
mainfrom
issue-63-adopt-cli-owned-build-migrate-build-rpc-to

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Closes#63.

Summary

  • This agent renders its own bootstrap-image Dockerfile and previously called WithDockerImages — the "agent with its own docker build" triage case. It now emits a DockerBuildPlan when the CLI supplies an output_directory, so the image becomes a durable, reproducible recipe the CLI builds multi-arch (linux/amd64 + linux/arm64) without needing the agent toolchain.
  • Re-pins core v0.3.4 → v0.3.6 for the recipe contract and helpers (BuildDockerBuildPlan, WithBuildPlan).
  • The legacy in-agent docker build is unchanged and still runs when output_directory is empty, so the CLI's response-type negotiation keeps working.

The recipe context is the recipe tree itself: the rendered builder/ files (Dockerfile + runtime-access.sql) plus the migrations the image applies at bootstrap. Core's SingleImageBuildPlan / RecipeBuildPlatforms convenience helpers named in the issue are not in the released core (v0.3.6 is the latest tag and its shared runners don't yet emit plans), so the migration uses the released primitives directly with the same result.

Test plan

  • go test ./... -skip '^TestCreateToRunDocker$' (matches CI) — green
  • New TestBuildEmitsRecipeToOutputDirectory: Build with output_directory returns a DockerBuildPlan (single recipe, builder/Dockerfile, context ., both platforms), writes a self-contained tree (builder + migrations), and the emitted plan verifies against that tree via VerifyDockerBuildPlan.
  • New TestBuildRecipeOmitsMigrationsWhenDisabled: with migrations disabled the recipe omits the migrations tree and still verifies.
  • Validation: a consumer with no codefly toolchain can docker buildx build --platform linux/amd64 -f builder/Dockerfile . from the emitted output directory.

When BuildRequest.output_directory is set, render the bootstrap image's
Dockerfile and build context there and return a DockerBuildPlan instead of
running docker in-process. The CLI builds the recipe multi-arch and pushes a
manifest list; the legacy in-agent build stays for the empty case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ipe (#63)
buildRecipe only emptied the builder/ and migrations/ subdirs, but
BuildDockerBuildPlan inventories the whole output directory and the recipe
context is its root (COPY .). Any content a caller left in a reused or
pre-populated output directory therefore leaked into the plan digest and the
built image — e.g. stale migrations survived a switch to no-migration. Empty the
whole directory the agent owns before rendering, matching the deployment
emitter (GenerateGenericKustomize).
copyTree skips directory entries, so an enabled-but-empty migrations directory
produced a context with no migrations/ at all, and the Dockerfile's
COPY migrations failed at buildx — a state the legacy in-agent build handled.
Provision the migrations directory explicitly so COPY resolves even with no
migrations authored yet.
Add regression tests for both: a pre-populated output directory must be purged,
and an empty migrations source must still yield a migrations directory.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit 723fcfe into mainAug 23, 2026
2 checks passed
Sign up for freeto 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.

Adopt CLI-owned build: migrate Build RPC to the build-recipe contract (cli#443)

1 participant

@antoinetoussaint-byte