Raja
Raja

Reputation: 11

Artifactory old artifacts clean up ( AQL) with retain latest 3 versions

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

Answers (2)

Swagata Kar
Swagata Kar

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

John Peterson
John Peterson

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

Related Questions