How do I create build retention, or discard old builds, without using a CI server?

If you wish to create build retention or discard old builds without using a Continuous Integration tool, you can either write a simple script, or a simple user pluginlugin using the following guidelines:


Script, using the REST API:

  1. Run an ‘All-Builds call if you want to go over all of the builds, or use the ‘Build Runs call, if that you want a specific build.

  2. Calculate the current time minus the ‘lastStarted’ time (on the All Builds call) or the ‘started’ time (on the Build Runs call) from the JSON response.

  3. Delete the builds that passed the time that you wish to keep by using the Delete Builds REST call.


User Plugin, using our Public API:

  1. Use Get Builds method to get a list of the builds.

  2. Calculate the time since the build run until the current time.

  3. Delete the builds that are passed the time that you wish to keep by using the ‘deleteBuild’ method.