perf: split stack build/push buildx driver and cache strategy#36
Merged
Conversation
`stack build` now targets the native `docker` driver and relies on the local builder cache only, so iteration no longer pays a registry cache roundtrip on every build. `stack push` targets `docker-container` with registry cache in/out, preserving multi-arch publishing and cross-machine cache sharing. Both commands gain `--builder` and `-f/--force`. The active buildx builder is switched (with confirmation unless `--force`) so the bake invocation can't silently run against an unintended builder, and the selected builder's driver is verified up front. Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
timzsu
approved these changes
May 12, 2026
Collaborator
timzsu
left a comment
There was a problem hiding this comment.
LGTM. One note worth resolving: the CLI docs are now stale because stack push enforces a docker-container buildx builder while docs/CLI.md still says Docker Engine with containerd image store is acceptable, so the PR should update the docs to describe the new flowmesh-multiarch builder setup plus the --builder and --force behavior.
Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Optimize local stack image iteration without giving up the multi-arch / cross-machine cache properties needed for publishing.
stack buildandstack pushhad been sharing one bake invocation that always pulled registry cache and assumed whatever buildx builder the user had active — fast for cold-start CI, slow for tight local edit-build-run loops. Split the two paths so each uses the buildx driver and cache layout that actually fits its workload.Changes
cli/stack/src/flowmesh_cli_stack/stack.py— split_run_bakeso load uses the nativedockerdriver with no registry cache, and push usesdocker-containerwith registry cache in/out. Replace the old_ensure_multiplatform_builder_supportcheck with_ensure_buildx_builder_ready(verifies the named builder exists and runs the expected driver, surfaces a create hint for the push builder) and_switch_active_buildx_builder(auto-switches the active builder, prompting for confirmation unless--force).stack buildandstack pusheach gain--builderand-f/--force; defaults aredefaultandflowmesh-multiarchrespectively.tests/cli/test_stack_build.py— cover the new helpers (driver match / mismatch / missing-with-hint, switch no-op / force / prompt / decline) and assert that load passes--builder+ no registry cache, and push passes--builder+ cache-from + cache-to.Design
The native
dockerdriver builds straight into the daemon's image store and reuses its layer cache, so local iteration avoids the registry roundtrip thatcache-from=type=registrywould force on every build. It cannot, however, exportcache-to=type=registryor build multi-arch images — exactly what push needs. Thedocker-containerdriver covers both, at the cost of an extra container hop and--loadno longer placing images directly into the daemon. Keeping each command on the driver that matches its goal removes the compromise.Auto-switching the active buildx builder (rather than only passing
--builderto bake) means follow-ondocker buildxinvocations the user runs by hand stay consistent with what the FlowMesh command just did. The confirmation prompt prevents a silent change to the user's environment;--forceis the CI / scripted escape hatch.For push, a missing
flowmesh-multiarchbuilder surfaces the exactdocker buildx create ...command the user needs to run — same UX as before, just routed through the new helper.Test Plan
Test Result
Pre-submission Checklist