问题描述
我们有一个使用 220Gb 的 Artifactory 服务器 - libs-snapshots-local
存储库使用 98% 该存储.
We have an Artifactory server that is using 220Gb - with the libs-snapshots-local
repository utilising 98% of that storage.
当我们查看存储库的配置时,我们注意到 Maven 快照行为设置为:unique
并且 Max Unique Snapshots 值为 0
.
When we looked at the configuration for the repository we noted that Maven snapshot behaviour was set to: unique
and that the Max Unique Snapshots value was 0
.
我们将 Max Unique Snapshots 值更改为 5.
We changed the Max Unique Snapshots value to 5.
当我们仍在处理快照时,这似乎有效,但是如果我们不再部署到快照(已发布),则它不会删除任何这些文件.
This seems to work when we are still working on the Snapshot, however if we no longer deploy to the snapshot (a release has been made) then it doesn't delete any of these files.
举个例子:我们在快照存储库中有以下内容:
As an example:we have the following in the Snapshots repository:
com/company/some/app/1.23-SNAPSHOT/.. (50+ artifacts)
com/company/some/app/1.24-SNAPSHOT/.. (5 artifacts)
Artifactory 将当前 SNAPSHOT 目录 (1.24-SNAPSHOT
) 保持在最多 5 个工件,但是 1.23-SNAPSHOT
目录中的工件数量永远不会减少.
Artifactory keeps the current SNAPSHOT directory ( 1.24-SNAPSHOT
) at a max of 5 artifacts, however the number of artifacts in the 1.23-SNAPSHOT
directory never decreases.
Artifactory 似乎使用工件的部署来触发清理检查 - 因此,如果您不再部署到该工件,则不会进行清理?
It seems that Artifactory uses the deployment of an artifact to trigger the cleanup check - Thus if you're no longer deploying to that artifact, then no clean up will be done?
我们如何让 Artifactory 开始删除 1.23-SNAPSHOT
文件夹中的多余工件?
How do we get Artifactory to start deleting the surplus artifacts in the 1.23-SNAPSHOT
folder?
推荐答案
你说得对,新快照的部署是删除旧快照的触发器.由于您的 1.23 神器爆炸是之前(错误)配置的剩余部分,因此您从现在开始就好了.
You are right, deployment of a new snapshot is the trigger for deletion of the old ones. Since your 1.23 artifacts explosion is the leftover of the previous (mis)configuration, you're good from now on.
删除旧快照的最简单方法就是将另一个(甚至是虚拟的)快照部署到 1.23 中.它将触发清理.
The simplest way to delete the old snapshots is just to deploy another (even dummy) snapshot into 1.23. It will trigger the cleanup.
另一个想法可能是创建另一个快照存储库并将 1.23 的最后 5 个快照移动到它.然后你可以安全地删除 1.23 文件夹并将其从临时存储库中移回.
Another idea might be creating another snapshots repo and moving the last 5 snapshots of 1.23 to it. Then you can safely delete the 1.23 folder and move it from the temporary repo back in.
所有这些都是清理一个或几个版本的有效选择,但它们不会扩展.如果您有很多版本需要清理,我建议您编写 一个简单的执行用户插件.
All those are valid choices for cleaning up one or couple of version, but they won't scale. If you have a lot of versions to cleanup I would recommend writing a simple execution user plugin.
你只是获取版本目录的子项和删除所有东西,除了你想离开的少数.
You just get the children of a version directory and delete everything except the few you want to leave.
这篇关于Artifactory 不删除唯一快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!