KeepLatestNVersionImagesByProperty does not work for multiple images
kenny-monster opened this issue · 4 comments
It seems that its working when only one image is involved. When I include multiple images, it only seems to apply the logic to one of the images:
My policy looks like this:
- name: my-policy
rules:
- rule: Repo
name: "my-repo"
- rule: IncludeDockerImages
masks:
- "my-image-1:*"
- "my-image-2:*"
- rule: DeleteDockerImagesNotUsed
days: 60
- rule: KeepLatestNVersionImagesByProperty
count: 2
number_of_digits_in_version: 1
Both images have not been used for more than 60 days. Running with either image alone results in the two latest image versions being filtered out as expected.
Originally posted by @kenny-monster in #60 (comment)
Yep, we do not test it with multiple images :(
https://github.com/devopshq/artifactory-cleanup/blob/b6bf413d5886cac2185d478eb3bbc0d8411a1de7/tests/test_rules_docker.py
I finally got around to having a look at fixing this. I don't code in Python much but I think the change is correct based on my debugging.
@kenny-monster hi, thank you for the contribution, I think you made a great job there! :)
@allburov thanks for getting it in so quickly! You're a legend. :)