devopshq/artifactory-cleanup

Question about deleting old images in Jfrog

julee761 opened this issue · 4 comments

When I run the code in my repo to delete old images, does it refer to the last downloaded date in the manifest.json file and delete images that have not been used within a certain period?

For example, I'm wondering if the result is the same as using the query below when deleting images that haven't been used for 6 months after querying them with AQL.
items.find({{"repo": {{"$eq": "{repo_key}"}}, "name": "manifest.json", "type": "file", "stat.downloaded": {{"$before": "7w"}}}}).include("name", "repo", "path", "stat")'

Anyone who knows, please help me

could you share your yaml config with rules you're using?

I haven't created the rule yet, but I'm asking before using it.
https://github.com/devopshq/artifactory-cleanup/blob/master/artifactory_cleanup/rules/docker.py
Looking at the file above, it looks like it's referencing the manifest.json file. Do you know if that's correct?

thats' correct. You can write the policy and run the command with --dry to see if that's what you need to remove or not

got it, thanks