我正在尝试从jfrog工件工厂的存储库列表中删除工件(超过6个月)。我正在创建如下所示的spec文件,并使用该规范删除使用jfrog。我的查询有什么方法可以执行aql in循环而不是手动更新回购名称: foobar
{
"files": [
{
"aql": {
"items.find": {
"repo": "foobar",
"$or": [
{
"$and": [
{
"modified": { "$lt": "2021-06-06T21:26:52.000Z"}
}
]
}
]
}
}
}
]
}```
jfrog rt del --spec /tmp/foo.spec --dry-run
I want to run the aql in loops only change will be the repo name . Is there a way to do it ?发布于 2022-09-26 07:17:30
我们已经发布了一个工具,可以帮助您避免错误,丑陋的AQL查询您的清理政策。https://github.com/devopshq/artifactory-cleanup
最近发布的版本支持YAML配置,就您的情况而言,如下所示:
# artifactory-cleanup.yaml
artifactory-cleanup:
server: https://repo.example.com/artifactory
# $VAR is auto populated from environment variables
user: $ARTIFACTORY_USERNAME
password: $ARTIFACTORY_PASSWORD
policies:
- name: Remove all files from repo-name-here older than 180 days
rules:
- rule: Repo
name: "reponame"
- rule: DeleteOlderThan
days: 180然后您可以在“delete”模式下运行它(默认情况下这是模式),以查看该工具将要删除的所有文件:
# Set the credentials with delete permissions
export ARTIFACTORY_USERNAME=usernamehere
export ARTIFACTORY_PASSWORD=password
artifactory-cleanup如果你同意的话-在销毁模式下运行
artifactory-cleanup --destroy若要查看多个存储库(如果它们与某些模式匹配),可以使用RepoByMask规则而不是Repo。
下面的示例将从myrepo.snapshot、otherrepo.snapshot和其他匹配掩码的文件中删除所有超过180天的文件。
- rule: RepoByMask
mask: "*.snapshot"https://stackoverflow.com/questions/70253900
复制相似问题