Reputation: 1
I see some teams push an unnecessary number of image artifacts (revisions/tags) to a harbor repository. I understand that there may be some rules that can be applied that prune artifacts but I do not like that concept because I don't believe that automated pruning would know which artifacts are actually used in various Kubernetes clusters.
Ideally we could configure a limit for the number of artifacts that can be pushed for an image, at the image scope, project scope, or an overall limit.
A scenario to clarify my question - suppose I have a project named "loose" and I have an image named "loose/greedy". I have been busy throughout the evening making many small changes to my code and Gitlab's CI pipeline is busy building an pushing images with new tags for each change I make. If I am using Python then each artifact can be quite large and my image can consume a lot of storage quickly. I would like to prevent a situation where I end up with too many artifacts for an image where a lot of storage space is wasted. So I would like to limit the number of artifacts for this image to 10, such that my CI pipeline will fail to push any new revisions to loose/greedy if 10 artifacts already exist in that image. This would force me to clean up the unnecessary artifacts before being able to push new image tags.
I hope that is clear. I appreciate any information about how to manage/limit the number of revisions of an image can be pushed to a project in Harbor.
Upvotes: 0
Views: 88
Reputation: 5543
Congratulations you just reinvented,retention policies.
You can create a policy that can Retain a maximum number of 10 artifacts in each repository
The harbor docs and content on the internet are quite good. The docs have many different examples.
Upvotes: 0