To avoid running out of disk space Artifactory allows you to limit the storage space allocated for your repositories.
In the Administration module, under Artifactory | Maintenance, set Enable Quota Control, and specify Storage Space Limit to specify the percentage of disk space that you allocate for your repositories. An attempt to store binaries above the allocated storage percentage will fail with an error. You may also set Storage Space Warning to specify at what percentage of disk space usage to receive a warning from Artifactory.
Working with snapshots is a standard development practice, however depending on the number of snapshots that are saved, this can use up large quantities of disk space.
To specify the maximum number of snapshots that may be stored, in the Administration module, select the Repositories and click the repository whose settings you want to edit.
In the Basic settings, check Handle Snapshots and then set the Max Unique Snapshots field. This value is zero by default, which means that all snapshots are saved.
Artifactory supports the "Max Unique Snapshots" tag for the following package types: Maven, NuGet, Gradle, Ivy, Docker, SBT.
To avoid issues of concurrency, Artifactory requires that you store a minimum of 2 unique snapshots, however can can control the maximum number of snapshots that are stored.
Every time you deploy a snapshot, Artifactory will check the value Max Unique Snapshots for the repository, and if exceeded will mark any excess old snapshots for deletion. Then, every 5 minutes, Artifactory runs a background process that deletes those oldest snapshots that have been marked. For example, if you set Max Unique Snapshots to 5 and deploy a sixth and seventh snapshot to the repository, then next time the background process runs, it will delete the two oldest snapshots.
In the case of Docker registries, you can limit the number of unique tags using the Max Unique Tags field in the Local Docker Repositories configuration.
When working with remote repositories, to optimize performance, Artifactory locally caches and aggregates snapshots of remote artifacts that are being used. However, if at some point, these artifacts are no longer used, Artifactory can identify and remove them.
You can control how long an unused artifact will remain cached before it is eligible for cleanup. In the Edit Repository screen under Advanced Settings, specify the number of hours in the Unused Artifacts Cleanup Period field.
By default this value is set to zero which means that an artifacts from the corresponding repository are never removed from the cache.
Cleaning up unused cached artifacts can be scheduled to run automatically during times when demands on the system are low using a Cron expression in the Administration module under Artifactory | Maintenance. You can also invoke an immediate run by clicking "Run Unused Cached Artifacts Cleanup"
Deleting unused cached artifacts is a resource-intensive operation, so to avoid concurrency and performance issues it is recommended to do it no more than once or twice a day, and preferably during "quiet time" such as outside of regular working hours.
Artifactory supports a complete manual deletion of an installed version. This is fully described in Deleting a Version.
Artifactory supports cleanup by allowing you to write custom User Plugins which you can develop to meet your own specific cleanup requirements.JFrog provides a number of
<a href="https://github.com/JFrog/artifactory-user-plugins/tree/master/cleanup" target="_blank">cleanup scripts on GitHub</a>
<a href="https://github.com/JFrog/artifactory-user-plugins/blob/master/cleanup/artifactCleanup/artifactCleanup.groovy" target="_blank">artifactCleanup plugin</a>
Using the Artifactory REST API, you may write scripts to implement virtually any custom cleanup logic. This provides you with an extensive and flexible set of customization capabilities as provided by the REST API.
When using JFrog CLI, Jenkins or Azure DevOps for continuous integration, you can configure a policy to discard old builds that are stored in Artifactory along with their artifacts.For more details please refer to the
<a href="https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin#ArtifactoryPlugin-ExcludedartifactsandtheBuildInfo" target="_blank">Artifactory Plugin</a>
<a href="https://www.jfrog.com/confluence/display/CLI/JFrog+CLI" target="_blank">JFrog CLI Documentation</a> <br> <a href="https://www.jfrog.com/confluence/display/JFROG/Jenkins+Artifactory+Plug-in" target="_blank">Jenkins Artifactory Plugin Documentation</a> <br> <a href="https://www.jfrog.com/confluence/display/JFROG/Azure+DevOps" target="_blank">Artifactory Azure DevOps Extension Documentation</a>