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 plugin using the following guidelines:
Script, using the REST API:
User Plugin, using our Public API:
-
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.
-
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.
-
Delete the builds that passed the time that you wish to keep by using the Delete Builds REST call.
-
Use Get Builds method to get a list of the builds.
-
Calculate the time since the build run until current time.
-
Delete the builds that are passed the time that you wish to keep using the ‘deleteBuild’ method.
-