I have been using Artifactory JFrog cli & AQL lanaguage to cleanup maven SNAPSHOT builds. So far I have been deleting everything by pattern matching *-SNAPSHOT. However I wish to have 1 build (the youngest) remain, as these are required for other builds. Would anyone be able to point me in the right direction, as I cant find anything obvious in Artifactorys docs.
My current query looks like the following
{
"files": [
{
"aql": {
"items.find": {
"repo": "test-repo",
"path": {"$match":"root-folder/*"},
"name": {"$match":"*-SNAPSHOT"},
"type": "folder",
"$or": [
{
"$and": [
{
"created": { "$before":"7d" }
}
]
}
]
}
}
}
]
}
Directory structure looks like the following
test-repo/root-folder/maven-project1/1.7.0-SNAPSHOT/
test-repo/root-folder/maven-project1/1.8.0-SNAPSHOT/
test-repo/root-folder/maven-project2/1.7.0-SNAPSHOT/
test-repo/root-folder/maven-project2/1.8.0-SNAPSHOT/
In this example I would want to keep the latest builds i.e. v1.8.0