Skip to content

fix: images clean matches registry tags, not capy prefix - #99

Merged
wpak-ai merged 3 commits into
developfrom
fix/images-clean-registry-tags
Jul 30, 2026
Merged

fix: images clean matches registry tags, not capy prefix#99
wpak-ai merged 3 commits into
developfrom
fix/images-clean-registry-tags

Conversation

@clean6378-max-it

@clean6378-max-it clean6378-max-it commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #98

images clean --all used to drop anything that did not start with capy-ubuntu-, so generic-profile images like ubuntu-latest-gcc15:latest never got removed even when they were in image-registry.yml.
It now loads the registry (same resolution as list and build), intersects installed repo:tag strings with registry docker_tag values, and only removes those matches. --registry is available on clean for parity with the other images subcommands.

Tests cover generic and Capy tags, dry-run, empty intersection, cwd registry discovery, and a capy-prefixed orphan tag that the old prefix filter would have removed incorrectly.
Run pytest tests/test_images_paths.py -k clean or tag a stand-in image and try localci images clean --all --dry-run.

Summary by CodeRabbit

  • New Features

    • Added optional registry-based filtering to localci images clean via --registry/-r.
    • When a registry is available, cleanup now removes only Docker tags present in both the local installation and the registry.
  • Bug Fixes

    • Removed hardcoded tag filtering, improving which images are selected for cleanup.
    • Now reports “No localci images found.” when no local images match the registry.
    • Kept existing dry-run behavior to avoid Docker changes.
  • Tests

    • Added regression coverage for the --all failure case when no registry can be resolved.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e7bb2f8-efd7-459c-ae23-7535c5573019

📥 Commits

Reviewing files that changed from the base of the PR and between 2e7bdad and 9e826a0.

📒 Files selected for processing (1)
  • cli/tests/test_images_paths.py

📝 Walkthrough

Walkthrough

images clean now resolves an optional or discovered image-registry.yml, intersects its Docker tags with locally installed tags, and removes only matching images. Tests cover sorting, dry runs, registry discovery, no-op behavior, generic tags, and Capy tags.

Changes

Registry-driven image cleanup

Layer / File(s) Summary
Registry-based cleanup selection
cli/localci/cli/images.py
images clean accepts --registry/-r, loads the resolved registry, and selects matching installed tags through a sorted intersection instead of the capy-ubuntu- prefix.
Cleanup behavior validation
cli/tests/test_images_paths.py
Tests verify deterministic target selection, explicit and discovered registries, dry-run behavior, no-op behavior, missing-registry errors, and cleanup of generic and Capy tags.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant images_clean
  participant ImageRegistry
  participant Docker
  User->>images_clean: clean --all [--registry]
  images_clean->>ImageRegistry: resolve and load image-registry.yml
  ImageRegistry-->>images_clean: docker_tag values
  images_clean->>Docker: list installed tags
  images_clean->>Docker: remove matching tags
  Docker-->>images_clean: removal result
Loading

Possibly related PRs

Suggested reviewers: wpak-ai, bradjin8

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: cleaning images by registry tags instead of a hardcoded capy prefix.
Linked Issues check ✅ Passed The changes align with #98 by matching installed image tags against registry docker_tag values and adding the --registry option.
Out of Scope Changes check ✅ Passed No unrelated or out-of-scope changes are evident from the summary; the edits stay within image cleanup and its tests.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/images-clean-registry-tags

Comment @coderabbitai help to get the list of available commands.

Comment thread cli/localci/cli/images.py
Comment thread cli/localci/cli/images.py
Comment thread cli/tests/test_images_paths.py
Comment thread cli/tests/test_images_paths.py
@wpak-ai
wpak-ai merged commit a9aa45a into develop Jul 30, 2026
11 of 13 checks passed
@wpak-ai
wpak-ai deleted the fix/images-clean-registry-tags branch July 30, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local-ci-test-system: make images clean --all match registry tags, not hardcoded capy-ubuntu-

3 participants