Prune app images correctly#134
Merged
Merged
Conversation
Signed-off-by: Mike Sul <mike.sul@foundries.io>
When multiple versions of the same app exist in the store, uninstall no longer always preserves the compose directory. Use CheckAppsStatus to determine accurately whether a specific app version is installed. It verifies the app bundle index, including the expected hashes of each bundle file. If the app being removed is installed, remove its compose directory even when other versions are present. Preserve the directory only when the removed version is not installed, since another installed version can be have its compose project files in this directory. Signed-off-by: Mike Sul <mike.sul@foundries.io>
Add t.Helper() to App fixture helper methods that wrap composectl commands such as pull, install, uninstall, run, and stop. This improves test failure reporting by attributing errors to the caller test line instead of the helper implementation, making failures easier to diagnose. Signed-off-by: Mike Sul <mike.sul@foundries.io>
87b2e1f to
488b5f6
Compare
Replace command-specific uninstall logic with compose.UninstallApps(). Extend checkUserListedApps() with optional multi-version support so an app name can resolve to all matching versions in the local store. This allows uninstall to remove every stored version when users specify only the app name, while exact app URIs still target a specific version. The change centralizes uninstall checks and cleanup behavior, keeping the CLI consistent with shared compose package logic. Signed-off-by: Mike Sul <mike.sul@foundries.io>
488b5f6 to
931fcdf
Compare
Add prune type support to UninstallApps() so callers can choose how image cleanup is performed after uninstall. Introduce two pruning modes: - only-app-images: prune only images of apps being uninstalled - all-unused-images: prune all unused images composectl uninstall now defaults to pruning images related to the apps being removed, while --prune enables full unused image cleanup. This keeps default uninstall behavior more targeted, while still allowing broader cleanup when explicitly requested. Note: the only-app-images mode is not fully correct yet. A follow-up test exposes the issue, and subsequent commits will address it. Signed-off-by: Mike Sul <mike.sul@foundries.io>
efccb2b to
3a34398
Compare
Collaborator
Author
|
@detsch This PR is ready for a review now. |
Fix image pruning in only-app-images mode. The previous implementation used the Docker image prune API with dangling=true, which only removes untagged dangling images and did not prune unused images that were still referenced by tags or digests. Uninstall now explicitly detects images not used by any container and, in only-app-images mode, removes only those images related to the apps being uninstalled. Add a new all-unused-images mode that removes every image not used by any container, regardless of whether it is related to compose apps. This makes uninstall cleanup more accurate for app-specific pruning while providing an optional broader system cleanup mode. Signed-off-by: Mike Sul <mike.sul@foundries.io>
3a34398 to
979c33b
Compare
detsch
approved these changes
Apr 24, 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.
Fix and improve image pruning after app uninstallation: