feat: carry --metadata-file through the bake build strategy - #733
Merged
Conversation
python-on-whales 0.81.0 added metadata_file support to docker.buildx.bake(), matching the existing docker.build() support. Wire bakery build --metadata-file through the --strategy bake path: - BakePlan.build() now accepts metadata_file and forwards it to `docker buildx bake --metadata-file`. - BakeryConfig.build_targets()'s BAKE branch passes metadata_file through to BakePlan.build() and, on success, loads the resulting file back into each target's build_metadata (buildx bake writes one entry per target keyed by the same UID used in the bake plan, so no merge step is needed, unlike the BUILD strategy). - Bump python-on-whales lower bound to >=0.81.0. Refs #728
This was referenced Aug 11, 2026
The `bake` and `build` strategies produce metadata files from entirely separate code paths -- raw `docker buildx bake --metadata-file` passthrough vs. `BakeryConfig._merge_sequential_build_metadata_files()` -- yet `bakery dgoss run --metadata-file` and `bakery ci publish` consume both through the same loader. Nothing pinned that equivalence, so a divergence would surface as a broken publish in CI rather than a test failure. Adds the two real metadata files captured while comparing the strategies (package-manager 2026.06.0, 6 targets, linux/amd64, --push with a temp registry) as fixtures, and a parametrized test class asserting the contract consumers depend on: UID-keyed top level, resolvable `<name>@sha256:...` image refs, `platform == linux/amd64`, `created_at` resolving from the descriptor annotation rather than the `datetime.now()` fallback, and matching UID/tag sets across the two producers. Also documents the multi-platform degradation: one invocation building several platforms yields an index descriptor with no platform, so `platform` is None and dgoss/merge lose per-platform selection. Closes #740
bschwedler
approved these changes
Aug 17, 2026
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.
Summary
python-on-whales 0.81.0 added
metadata_filesupport todocker.buildx.bake(), matching the existingdocker.build()support. This wiresbakery build --metadata-filethrough the--strategy bakepath, which previously ignored it.BakePlan.build()now acceptsmetadata_fileand forwards it todocker buildx bake --metadata-file.BakeryConfig.build_targets()'sBAKEbranch passesmetadata_filethrough toBakePlan.build()and, on success, loads the resulting file back into each target'sbuild_metadata.buildx bake --metadata-filewrites one entry per target keyed by the same UID used in the bake plan, so (unlike theBUILDstrategy) no separate merge step is needed.python-on-whaleslower bound to>=0.81.0.Closes #736, #740
Refs #728, #735
Testing
uv run pytest test/ -m "not slow and not image_build"— 2058 passeduv run ruff check/ruff format --check— cleantest_build_args_metadata_fileintest/image/bake/test_bake.pyTestBuildTargetsBakeStrategyintest/config/test_config.pycovering metadata_file forwarding, defaultNonebehavior, and metadata being loaded back into targetsTestStrategyMetadataCompatibilityintest/image/test_image_metadata.py(Test: pin the bake/build metadata file contract with real fixtures #740): two real captured metadata fixtures (strategy-bake-metadata.json,strategy-build-metadata.json) plus a parametrized test pinning the contract both strategies must satisfy