Skip to content

feat(build): support feature installation on image-reference configs#134

Merged
pofallon merged 2 commits into
mainfrom
feat/build-image-ref-features
May 29, 2026
Merged

feat(build): support feature installation on image-reference configs#134
pofallon merged 2 commits into
mainfrom
feat/build-image-ref-features

Conversation

@pofallon
Copy link
Copy Markdown
Contributor

Summary

Addresses half of the deferred "feature installation during build is not yet supported for compose or image-reference configurations" gate (build/mod.rs), surfaced this session by the image-reference-with-features canary.

Image-reference builds already route through execute_docker_build (a synthetic FROM <image> Dockerfile) which applies the deterministic deacon-build:<hash> tag, so the existing post-build feature-layering pass handles them with no new integration path — only the gate needed to stop rejecting them. Compose builds still fail fast (tracked separately): layering features onto a targeted compose service needs the up compose flow.

Latent bug also fixed

After features are layered into a new image, the base build's tags (the --image-names and the deterministic tag) still pointed at the pre-feature base image — so --image-name resolved to an image without the features. execute_build now re-tags the feature-extended image with each of those tags (new retag_image helper). This also corrects the Dockerfile + features path, whose canaries previously only checked the JSON outcome, not image contents.

Changes

  • build/mod.rs: narrow the feature-install gate to compose-only; re-tag the feature-extended image with the base build's tags; refresh stale comments.
  • examples/build/image-reference-with-features: base alpine:3.19debian:bookworm-slim (bash feature script); canary verifies the feature artifact in the named image.
  • New integration_build regression test asserting --image-name resolves to the feature-extended image.

Testing

  • New test test_build_image_reference_with_features_tags_final_image passes (Docker).
  • buildkit-gated-feature, dockerfile-with-features, image-reference-with-features canaries all pass end-to-end (feature artifact present in the named image).
  • cargo fmt/clippy clean.

Remaining deferral

Compose + features build (compose-with-features canary) — needs the compose-service feature-layering path; left as a tracked follow-up.

🤖 Generated with Claude Code

Addresses half of the deferred "feature installation during build is not yet
supported for compose or image-reference configurations" gate
(build/mod.rs). Image-reference builds already route through
`execute_docker_build` (a synthetic `FROM <image>` Dockerfile) which applies
the deterministic `deacon-build:<hash>` tag, so the existing post-build
feature-layering pass can handle them with no new integration path — only the
gate needed to stop rejecting them. Compose builds still fail fast (tracked
separately) since layering features onto a targeted compose service needs the
`up` compose flow.

Also fixes a latent bug the image-reference path exposed: after features are
layered into a *new* image, the base build's tags (the `--image-name`s and the
deterministic tag) still pointed at the pre-feature base image, so
`--image-name` resolved to an image *without* the features. `execute_build`
now re-tags the feature-extended image with each of those tags (new
`retag_image` helper). This also corrects the Dockerfile+features path, whose
canaries previously only checked the JSON outcome, not image contents.

- `examples/build/image-reference-with-features`: base image alpine -> debian
  so the bash feature install script runs; the canary now verifies the feature
  artifact is present in the named image.
- New `integration_build` regression test asserting `--image-name` resolves to
  the feature-extended image.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pofallon pofallon merged commit 62f0a99 into main May 29, 2026
10 checks passed
@pofallon pofallon deleted the feat/build-image-ref-features branch May 29, 2026 00:01
pofallon added a commit that referenced this pull request May 29, 2026
…139)

Closes the last part of the deferred "feature installation during build is not
yet supported for compose or image-reference configurations" gate (the
image-reference half landed in #134). Compose builds now resolve the target
service's shape and build a feature-extended image, matching `up`.

- Refactor: extract the shape→feature-build core out of `up`'s
  `install_features_for_compose` into a reusable `pub(crate)
  resolve_compose_feature_image` (takes `&ComposeProject`, no project
  mutation). `up` calls it then sets `service_image_override`; behavior
  unchanged (both compose-feature integration tests still pass).
- `build`: new `execute_compose_build_with_features` resolves the service
  shape (`image:` or `build:`), builds the feature-extended image via the
  shared helper, tags it with the deterministic `deacon-build:<hash>` tag plus
  any `--image-name`s (reusing `retag_image`), and writes the feature lockfile.
  The generic post-build layering pass is skipped for compose.
- Remove the compose feature-install rejection gate.
- Example `compose-with-features`: base alpine → debian (bash feature script);
  exec.sh + README now verify `/hello.txt` is present in the named image.
- New docker-gated `integration_compose_features_build` test asserting
  `deacon build --image-name` on a compose+features config resolves to the
  feature-extended image. Fixes #135.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant