Custom Directory Retention Policy

Hello

Is there a way to apply retention policy to a custom install directory on the target server. We deploy to a custom directory and would like to only maintain a certain number of releases.

thanks.

Hi,

Thanks for reaching out! Unfortunately this isn’t possible. The only way to fully use retention policies is by letting Octopus decide the deployment path based on its own conventions. Quoting the documentation:

The Tentacle settings delete packages, and expanded files and folders from packages on the Tentacle machine that is being deployed to. Note that if you use the Custom Installation Directory feature, we will never delete from that directory during retention policies. This can be purged during deployment in the project step settings. But it is assumed this will have a working release in it.

The only way around this would be to setup your own retention policy system. On the tentacle machine we keep a file called DeploymenyJournal.xml which has entries for each deployment that was done, included the “Custom Install dir” where the files were dropped. This is the file we use to know what to delete when we run retention policies, and you could also use it for your custom script.

Regards,
Dalmiro

Thanks Dalmiro, could you share the retention policy script used , I am assuming octopus internally uses PowerShell scripts?

We use C# for that particular bit. You can start by looking at this search in Calamari.