Artifactory not deleting Unique Snapshots

最后都变了- 提交于 2019-12-29 07:41:40

问题


We have an Artifactory server that is using 220Gb - with the libs-snapshots-local repository utilising 98% of that storage.

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.

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 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.

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?

How do we get Artifactory to start deleting the surplus artifacts in the 1.23-SNAPSHOT folder?


回答1:


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.

The simplest way to delete the old snapshots is just to deploy another (even dummy) snapshot into 1.23. It will trigger the cleanup.

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.



来源:https://stackoverflow.com/questions/27905747/artifactory-not-deleting-unique-snapshots

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!