Reputation: 11
Is there any way to delete an artifacts with retain(exclude) latest 3 versions with AQL? I would like for example to delete snapshots from snapshots repo's and it should retain latest 3 versions. Any idea how to perform this task or if it is possible at all, especially the part with keeping the latest 3 versions. Any suggestion is appreciated.
Thanks
Upvotes: 1
Views: 813
Reputation: 1
You may try with the offset option in AQL. I have solved that issue for maven repos. It is enough for me. In my case, I had to retain the last 3 versions. This query worked to retrieve all the versions except the last 3.
items.find({
"repo":"<repoName>",
"path": {"$match":"<path>"},
"name": {
"$match": "*.pom"
}
}).sort({"$desc" : ["modified"]}).offset(3)
You may find more info here.
Upvotes: 0
Reputation: 389
There is an Artifactory user plugin that will delete artifacts that age out of the system after a given time interval.
You can find it here
The default is one month of inactivity to get purged.
Upvotes: 1