Skip to content
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

KeepLatestNVersionImagesByProperty does not work for multiple images #77

Closed
kenny-monster opened this issue Oct 4, 2022 · 4 comments · Fixed by #97
Closed

KeepLatestNVersionImagesByProperty does not work for multiple images #77

kenny-monster opened this issue Oct 4, 2022 · 4 comments · Fixed by #97
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@kenny-monster
Copy link
Contributor

kenny-monster commented Oct 4, 2022

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)

@allburov
Copy link
Member

allburov commented Oct 5, 2022

Yep, we do not test it with multiple images :(
https://github.com/devopshq/artifactory-cleanup/blob/b6bf413d5886cac2185d478eb3bbc0d8411a1de7/tests/test_rules_docker.py

@kenny-monster
Copy link
Contributor Author

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.

@allburov
Copy link
Member

allburov commented Mar 6, 2023

@kenny-monster hi, thank you for the contribution, I think you made a great job there! :)

@kenny-monster
Copy link
Contributor Author

@allburov thanks for getting it in so quickly! You're a legend. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
2 participants