There are three ways to safely remove unnecessary build information:
With the REST API
Via the Artifactory UI
Using the buildCleanup user plugin.
If cleanup has not been done for some time, any of these methods may be time consuming, depending on the number and the size of builds; however if "pruning" of old build-information is performed on a regular basis, the time required should not be problematic. This page contains information about the different cleanup methods in Artifactory that can help minimize storage consumption.
Using the REST API, the whole process can of course be automated using a client-side script that iterates over a range of build numbers in order to delete a group of builds. The buildCleanup user plugin can be used to delete builds older than a given number of days. It can be manually executed using the REST API or according to a hard coded cron expression (defaults to every 10 seconds). Read more about User Plugins in Artifactory on our Wiki page.
We recommend first dry-running the plugin (using the default configuration of the buildCleanup.properties file) and paying close attention to the detected delete candidates on the artifactory.log (accessible via the Admin tab in the Artifactory UI under "Advanced" ? System logs (the plugin will print all the delete candidates on the artifactory.log). It's necessary to change the "dryRun" property from "true" to "false" in the buildCleanup.properties file for the plugin to actually delete builds. The days parameter is also specified in this file with the default value of 3 days.
Both the Delete Builds REST API and the buildCleanup user plugin do not delete build related artifacts. The Delete Builds REST API will only delete build related artifacts if specified to do so with the "artifacts" parameter, its default value is "0". Here's an example without that option:
curl -X DELETE -uadmin:password "http://localhost:8081/artifactory/api/build/maven_multi?buildNumbers=15"
This command will delete build number "15" of the "maven_multi" project. You can also delete all the builds under a certain project by not specifying the buildNumbers parameter:
curl -X DELETE -uadmin:password "http://localhost:8081/artifactory/api/build/maven_multi"