如何使用AQL或CLI搜索旧docker标签
主要目的是搜索一些旧的docker标签AQL或CLI和列出Docker标签是用来删除它们的。
例如,下面的说明向我们展示了如何搜索4(限制)老hello world中基于修改日期的标签docker-local存储库。
总标签数
$ curl -s -X GET http://localhost:8081/artifactory/api/docker/docker-local/v2/hello-world/tags/list -u admin:password | jq '。标签|长度
11
$计算偏移量(7)使用总标签编号(11)及极限(4)
11 - 4 = 7指定偏移量(7)及极限(4)参数和搜索标签(AQL版本)
$ curl -X POST http://localhost:8081/artifactory/api/search/aql -u admin:password -H "Content-Type: text/plain" -d 'items.find({"repo":"docker-local"},{"path":{"$ne":"."}},{"type":"folder"}).include("repo","name","path","modified")。Sort ({"$asc": ["modified"]}).offset(7) .limit (4)'{
"results": [{
"repo": "docker-local"
"path": "hello-world"
name: 7.0;
"modified": "2020-06-19T23:44:40.670Z"
},{
"repo": "docker-local"
"path": "hello-world"
name: 8.0;
"modified": "2020-06-19T23:44:42.898Z"
},{
"repo": "docker-local"
"path": "hello-world"
name: 10.0;
"modified": "2020-06-19T23:44:44.983Z"
},{
"repo": "docker-local"
"path": "hello-world"
name:“9.0”,
"modified": "2020-06-19T23:44:44.983Z"
}),
"range": {
"start_pos": 7,
"end_pos": 4,
“total”:4,
limit: 4
}
}
$指定偏移量(7)及极限(4)参数和搜索标签(CLI版本)
$ cat spec.json
{
“文件”:[
{
" aql ": {
”项。找到":{
“回购”:“docker-local”,
“路径”:{" $不“:”。"},
“类型”:“文件夹”
}
},
“sortBy”:“修改”,
“排序方式”:“asc”,
“抵消”:7,
“限制”:4
}
]
}
$ jfrog rt s——url http://localhost:8081/artifactory——user admin——password password——spec spec.json
[信息]搜索工件…
[信息]发现4件文物
(
{
“路径”:“docker-local / hello world / 7.0”,
“类型”:“文件夹”,
“创建”:“2020 - 06 - 19 t23:44:40.670z”,
“修改”:“2020 - 06 - 19 t23:44:40.670z”
},
{
“路径”:“docker-local / hello world / 8.0”,
“类型”:“文件夹”,
“创建”:“2020 - 06 - 19 t23:44:42.898z”,
“修改”:“2020 - 06 - 19 t23:44:42.898z”
},
{
“路径”:“docker-local / hello world / 10.0”,
“类型”:“文件夹”,
“创建”:“2020 - 06 - 19 t23:44:44.983z”,
“修改”:“2020 - 06 - 19 t23:44:44.983z”
},
{
“路径”:“docker-local / hello world / 9.0”,
“类型”:“文件夹”,
“创建”:“2020 - 06 - 19 t23:44:44.983z”,
“修改”:“2020 - 06 - 19 t23:44:44.983z”
}
]
$
