Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Artifactory not deleting Unique Snapshots

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?

like image 218
Tim Sparg Avatar asked Jan 12 '15 15:01

Tim Sparg


1 Answers

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.

like image 103
JBaruch Avatar answered Nov 10 '22 23:11

JBaruch