Proposal: Add Minimum and Maximum Retention Policies to Acr Purge
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với entry point của acr purge và lần theo hành vi hiện có của --keep, việc lọc tag và dangling manifest, xếp hạng, phân trang và báo cáo dry-run. Sử dụng các tiêu chí chấp nhận làm định nghĩa done: duy trì khả năng tương thích, xác thực các tổ hợp flag, áp dụng độc lập các chính sách tối thiểu/tối đa và bao quát phân trang, bộ lọc, các mục bị khóa, các timestamp bằng nhau và những manifest mới trở thành dangling.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is the problem you're trying to solve
Customers need to combine age-based retention with minimum and maximum count limits.
For example, customers may want either of these behaviors:
- Delete tags older than 3 days or outside the 10 most recent matching tags.
- Delete tags older than 3 days only when they are outside the 10 most recent matching tags.
The existing --keep option does not express either policy consistently because it preserves items only from the set already eligible for age-based deletion. Changing its behavior would break existing purge configurations.
Describe the solution you'd like
Add explicit minimum and maximum retention options:
| Option | Behavior |
|---|---|
--min-tags N |
Protect the newest N matching tags from age-based deletion |
--max-tags N |
Retain no more than N matching tags per repository |
--min-untagged-manifests N |
Protect the newest N dangling manifests from age-based deletion |
--max-untagged-manifests N |
Retain no more than N dangling manifests per repository |
Maximum retention: OR behavior
acr purge \
--registry example \
--filter "repository:.*" \
--ago 3d \
--max-tags 10
A matching tag is deleted when it is older than 3 days or outside the 10 most recent matching tags. This is a hard ceiling; fewer than 10 tags may remain after applying the age policy.
Minimum retention: AND behavior
acr purge \
--registry example \
--filter "repository:.*" \
--ago 3d \
--min-tags 10
A matching tag is deleted only when it is older than 3 days and outside the 10 most recent matching tags. The newest 10 matching tags are protected from age-based deletion.
The same behavior applies independently to dangling manifests:
acr purge \
--registry example \
--untagged-only \
--ago 3d \
--min-untagged-manifests 20 \
--max-untagged-manifests 100
Combining minimum and maximum retention
Minimum and maximum options may be combined:
acr purge \
--registry example \
--filter "repository:.*" \
--ago 3d \
--min-tags 10 \
--max-tags 50
This creates three retention zones:
- The newest 10 matching tags are protected from age pruning.
- Tags 11 through 50 are retained only while newer than 3 days.
- Tags beyond 50 are deleted regardless of age.
Equivalent selection logic:
delete :=
rank > maxTags
OR
(olderThanAgo AND rank > minTags)
Compatibility and validation
- Existing
--keepbehavior remains unchanged. --keepcannot be combined with the new count policies for the same resource.--min-*requires--ago, because it guards age-based deletion and does not select items independently.--max-*works with or without--ago.- When both are supplied, the minimum must not exceed the maximum.
- Limits apply per repository and effective filter.
- Tag and dangling-manifest limits are independent.
- Items are ranked by
LastUpdateTime, newest first, with deterministic tie-breaking. - When using
--untagged, manifest retention is evaluated after tag deletion. - Locked items that prevent satisfying a maximum are reported clearly.
- Dry-run output identifies whether deletion is caused by age, maximum count, or both.
Repository-level conditions that determine whether purge runs at all, such as --purge-if-tags-exceed, are a separate feature and are not part of this retention proposal.
Acceptance criteria
- Age-only, minimum, maximum, and combined policies work for tags and dangling manifests.
- Minimum options provide AND behavior and maximum options provide OR behavior.
- Ranking works across paginated results.
- Existing filters and
--keepbehavior remain compatible. - Invalid flag combinations produce clear errors.
- Tests cover pagination, filters, locked items, equal timestamps, and manifests made dangling during the purge.
- Ngôn ngữ chính
- Go
- Star
- 71
- Fork
- 52
- Merge trung bình
- 8 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/acr-cli
-
Add Tag Exclusions to ACR PurgeĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Azure/acr-cli#644 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
Azure/acr-cli#621 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Azure/acr-cli#611 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/acr-cli
Issue tương tự
-
Discriminator mapping keys are listed in a random orderCó thể đã có người làm @reuvenharrison đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Idle compaction monitors LIST the replica every tick when the newest destination file spans more than one TXIDCó thể đã có người làm @pishuv đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
benbjohnson/litestream#1563 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-research agent-review-finding chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
jordansmall/spindrift#4922 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
gcsartifact: deleting a missing version returns an errorCó thể đã có người làm @ktsoator đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày