From f5bfc0b1199103e4e13c1a6dc54276151a937340 Mon Sep 17 00:00:00 2001 From: colinmoynes Date: Tue, 13 Jan 2026 11:20:56 +0000 Subject: [PATCH 1/2] single images now deleted successfully --- Docker/Sonar/sonar.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Docker/Sonar/sonar.py b/Docker/Sonar/sonar.py index baf9c0d..ffa74ef 100755 --- a/Docker/Sonar/sonar.py +++ b/Docker/Sonar/sonar.py @@ -106,6 +106,11 @@ def make_request(url, headers=None, method='GET', data=None, return_headers=Fals time.sleep(wait + 0.5) if method == 'DELETE': + # Fix: Consume content to prevent IncompleteRead errors even if 0 bytes expected + try: + _ = response.read() + except Exception: + pass logger.info(f"DELETE Success: {url}") return True @@ -772,8 +777,9 @@ def get_image_analysis(workspace, repo, img_name, delete_all=False, delete_tag=N for group in groups: if not group: continue parent = group[0] - # Only delete manifest lists - if parent.get('type') == 'manifest/list': + + # Modified to allow deletion of both manifest lists AND single images + if parent.get('type') in ['manifest/list', 'image']: should_delete = False if delete_all: should_delete = True From 226f59c402f56bf81758885157944a6ee511c9f6 Mon Sep 17 00:00:00 2001 From: colinmoynes Date: Tue, 13 Jan 2026 12:04:12 +0000 Subject: [PATCH 2/2] changelog and readme update --- CHANGELOG.md | 2 ++ Docker/Sonar/README.md | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8742f40..2a55900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Sonar - Added `--filter` flag which accepts the (Package Search Syntax)[https://docs.cloudsmith.com/artifact-management/search-filter-sort-packages] string. e.g. `--filter "downloads:>0"`. +- Deletion now correctly works against non multi-arch images. Previously they where ignored and only multi-arch images were being deleted. Additionally improved log output for deletions. + ## [Sonar] [v1.1] [2026-01-07] diff --git a/Docker/Sonar/README.md b/Docker/Sonar/README.md index 31c5ed7..b366586 100644 --- a/Docker/Sonar/README.md +++ b/Docker/Sonar/README.md @@ -84,12 +84,12 @@ Here is a summary of its capabilities: 2. **Advanced Flags** | Flag | Description | |-----------------------|--------------------------------------------------------------| - | `--detailed` | Shows every child digest (arch/os) and individual download counts. | - | `--untagged` | Finds manifest lists that have no tags (orphaned). | - | `--untagged-delete` | Deletes any untagged manifest lists found. | - | `--delete-tag` | Deletes a specific tag from the repository. | - | `--delete-all` | Wipes all images and manifest lists detected by the scan. | - | `--force` | Force deletion without interactive prompt. | + | `--detailed` | Shows child digests for multi-arch images. | + | `--untagged` | Show untagged images with no manifest/list (orphaned). | + | `--untagged-delete` | Deletes any untagged images found. | + | `--delete-tag` | Deletes an image via tag. | + | `--delete-all` | Wipes all images and manifest lists detected. | + | `--force` | Force deletion without interactive prompt. Helpful for programmatic workflows. | | `--output` | Use `json` value to output results to JSON format. | | `--filter` | Query using Package Syntax Filtering. |