I have a question about usage of the Artifactory REST API. Some guidance would be useful.
I'm building a script that exercises Artifactory's REST API. The goal of this script is to find artifacts that are old, meet some other requirements, and then delete them. (Doesn't every Artifactory owner end up building one of those?)
There is a documented "Artifacts Not Downloaded Since", which returns a list of files. For "artifacts" I would rather have expected some concept that contains multiple files (like for Maven: a POM and a few JARs). The fact that it returns just single files has me now strip the file name, then delete the whole folder.
- Query returns: https://.../repository/api/storage/libs-snapshot-local/com/x/y/1.0.0-SNAPSHOT/y-1.0.0-SNAPSHOT.jar
- I strip: https://.../repository/api/storage/libs-snapshot-local/com/x/y/1.0.0-SNAPSHOT/
- I delete that stripped folder.
I am scared that the folder in question contains other files (a POM file or some other file in that folder) that was downloaded more recently, yet still gets deleted now.
Why is this stuff not reported by the REST API on the artifact level (GAV level)?
For Docker repositories a related question, does "Not Downloaded Since" at all consider child containers? Or is there an approach that I should use to just delete the tag, and Artifactory will auto-remove the associated, but unused, image/layer files?