使用 jfrog CLI 和 AQL 清理旧工件
JFrog CLI 是一个紧凑而智能的客户端,它提供了一个简单的界面来自动访问 Artifactory。作为 REST API 的包装器。
安装 JFrog CLI
在 MAC 上
brew install jfrog-cli-go
带卷曲
curl -fL https://getcli.jfrog.io | sh
JFrog CLI 语法
jfrog target command-name global-options command-options arguments
目标 - 您希望对其执行命令的产品:
rt: JFrog Artifactory
bt: JFrog Bintray
mc: JFrog Mission Control
xr: JFrog Xray
配置 JFrog cli
jfrog rt c Artifactory --url=https://artifactory.eqs.intra/artifactory --apikey=<add api key> #can generate api key from user profile
生成 API 密钥
登录到 artifactory -> 点击用户名并编辑配置文件 -> 在身份验证设置下
JFrog CLI configuration Official Documentation
搜索文物
显示来自的工件
- 注册表 - docker
- 路径 - *
- 下载状态=null#未下载
- 在1 month之前创建
{
"files": [
{
"aql": {
"items.find": {
"repo": {"$eq":"docker"},
"path": {"$match":"*"},
"name": {"$match":"*"},
"stat.downloads":{"$eq":null},
"$or": [
{
"$and": [
{
"created": { "$before":"1mo" }
}
]
}
]
}
}
}
]
}
AQL Official Documentation.
运行搜索并验证您要删除的包
jfrog rt s --spec artifactory.spec
按照规范文件删除工件
jfrog rt del --spec artifactory.spec
Insight Page