Batch delete all undeployed releases / no longer needed releases


Is it possible to automatically/via script rather than manually one-by-one delete all undeployed released for a given project?

In a similar way we would require to delete all ‘dev’ releases (deployed or not) for a given branch
e.g. <- this is the final release of 16.0.0 branch - we no longer need .1 and .2

We have about ~100 dev released per branch - is there a way to do it automatically rather than one-by-one?


Hi Mau,

Thanks for getting in touch! And sorry for the delayed reply here. You can do this automatically and configure it to only delete all ‘dev’ releases using our retention policy feature. This feature will let you configure Octopus to delete old releases and can be configured based on Lifecycle.

The below link is a very useful documentation page on Retention Policies in Octopus.

You can configure your retention policy from your Lifecycle page in Octopus. The screenshots in the documentation give a good step-by-step on how to do this.

The Octopus Server settings delete releases from the database. This is a data deletion. It also cleans up any artifacts, deployments, tasks, events and logs attached to the release. Releases that are still on the overall dashboard are never deleted. It is assumed to be the working release and may still be promoted (even if their dates fall well outside the retention policy). No packages from the internal NuGet repository will be deleted as part of this policy, but they may be deleted by a corresponding repository retention policy.
You can set individual retention policies to phases. This gives you much more control over environments, such as never deleting from Production but having a strict rigorous deletion from your Development environment.

Please let me know if that helps or if you have any further questions. :slight_smile: