devopshq / artifactory-cleanup

Extended cleanup tool for JFrog Artifactory
MIT License
121 stars 65 forks source link

Question about deleting old images in Jfrog #148

Closed julee761 closed 2 months ago

julee761 commented 2 months ago

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

allburov commented 2 months ago

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

julee761 commented 2 months ago

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?

allburov commented 2 months ago

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

julee761 commented 2 months ago

got it, thanks