-
Notifications
You must be signed in to change notification settings - Fork 46
feat: add --untagged-only
for independent manifest cleanup
#489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1dda8ef
to
fe3c53c
Compare
@estebanreyl, as the |
- Add unit tests for untagged-only flag validation - Add integration test script for real Azure registry testing - Update main test script with untagged-only test cases - Fix index out of range bug in GetUntaggedManifests - Test scenarios include dry-run, locked manifests, and filters
- Remove GetManifest expectations for untagged manifests (not called) - Fix UpdateAcrManifestAttributes mock to return proper response - Update GetRepositories test to match actual behavior - Update mutual exclusivity test to accept Cobra's error message - All unit tests now passing (100% success rate)
e718249
to
a160bef
Compare
I like the change, but I am little hesitant when it comes to this type of usability change scenarios, so I messaged a couple of PMs to take a look and will see what they say and will update. I am sorry its taken so long |
Again, no worries at all, @estebanreyl! 🙇 |
Hey @balcsida , Thanks for making several PRs to |
@FeynmanZhou Thanks for the suggestion! I'm familiar with retention policies, but they don't address the specific issues this PR solves: Organizational constraintsSome organizations (like ours) face significant bureaucratic hurdles when implementing policies (especially preview ones). A scheduled cleanup pipeline using existing CLI tools is often much more practical to deploy and manage. User experience issuesThe linked issues (#64, #83, #95, #480, #486) demonstrate a clear pattern: users consistently expect the Complementary solutionRather than replacing retention policies, this PR provides an alternative approach for teams that need more granular control or face organizational constraints. The
This change maintains full backward compatibility while preventing the unintended manifest deletions that several users have reported. |
--untagged-only
for independent manifest cleanup
Purpose of the PR
This PR introduces a new
--untagged-only
flag to the purge command, enabling users to clean up untagged manifests independently without affecting tagged manifests. This addresses the confusion and limitations reported in various issues and provides a comprehensive solution for dangling manifest cleanup.Key Features Added
--untagged-only
flag: Exclusively targets untagged manifests without deleting any tags first--ago
and--keep
support: When used with--untagged-only
, these flags become optional and provide additional filtering capabilities:--ago
: Filter untagged manifests by age (delete only manifests older than specified duration)--keep
: Preserve the most recent N untagged manifests--untagged
and--untagged-only
Implementation Details
--untagged
and--untagged-only
are mutually exclusive to prevent confusionpurgeDanglingManifests
function--keep
is specifiedEnhanced User Experience
--untagged-only
workflow)Usage Examples
Key Differences Between Flags
--untagged
: Used as a cleanup step after tag deletion. Requires--filter
and--ago
. Deletes tags first, then cleans up untagged manifests left behind.--untagged-only
: Primary tool for dangling manifest cleanup. Works independently without deleting tags. Optional--filter
,--ago
, and--keep
for targeted cleanup.Breaking Changes
None. The existing
--untagged
flag behavior remains unchanged for backward compatibility.Testing
Fixes #64
Fixes #83
Fixes #95
Fixes #480
Fixes #486