Artifactory不删除唯一快照

Artifactory不删除唯一快照

本文介绍了Artifactory不删除唯一快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 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,并且最大唯一快照"值是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.

我们将最大唯一快照数"值更改为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.

例如:我们在Snapshots存储库中具有以下内容:

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不删除唯一快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 13:43