fix(image): preserve active and infrastructure aliases - #2031
Open
stephenlclarke wants to merge 2 commits into
Open
fix(image): preserve active and infrastructure aliases#2031stephenlclarke wants to merge 2 commits into
stephenlclarke wants to merge 2 commits into
Conversation
Match active container images by OCI digest, normalize configured infrastructure references, and retain fetched builder references in container state. Add unit and CLI regressions covering alias-safe image prune behaviour.
Check the image service directly by OCI digest before and after prune so the regression cannot pass on filtered inspect output.
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.
Important
All commits in this pull request are signed and verified.
Type of Change
Motivation and Context
During testing of my
container-composeplugin, I found and fixed the following issue:image prune --allcompared image reference strings to decide whether active containers used an image. Equivalent OCI references can differ after registry and tag normalisation, so prune could treat an active image as unused.The builder path also stored the configured reference instead of the fetched image reference, and infrastructure-image filters compared configured and stored references literally. Together, these behaviours could expose a normalised builder or init image to list, inspect, delete, or prune operations and could unnecessarily recreate an otherwise matching builder.
Fixes #2030.
Reproduction
apple/container-builder-shim/builder:0.13.0withregistry.domain = "ghcr.io".container image prune --all.container builder status.Before this change, the configured and stored aliases can compare unequal even though they resolve to the same OCI image. The deterministic unit regression models that condition with two references sharing one descriptor digest.
Changes
Testing
Documentation is not needed because command syntax and user-facing behaviour are unchanged.
Validation
Validated on macOS 26.5.1 (25F80), Xcode 26.6 (17F113), and Swift 6.3.3 against
apple/containermainat27e5043165178edb095c901624857b51a2ea8e1a.HAWKEYE_AUTO_INSTALL=1 make fmtHAWKEYE_AUTO_INSTALL=1 make checkHAWKEYE_AUTO_INSTALL=1 make test: 570 tests in 71 suites passedswift test --disable-automatic-resolution -Xswiftc -warnings-as-errors --filter 'ImagePruneTests|UtilityTests': 14 tests in 2 suites passedtestImagePrunePreservesBuilderImage: passed in 45.445 secondsgit diff --checkThe integration regression starts the builder, records its OCI digest, confirms that digest is present in the unfiltered image service, pulls an ordinary unused image, runs
image prune --all, verifies the ordinary image is removed, verifies the builder digest remains stored, and verifies the builder remains running.