Packages not being deleted

I’ve got about 40GB of packages on my deployment server, I’ve configured the repository retention by when the task runs I get hundreds of messages like the following

“It will be kept. Reason: the package used by a project that uses #{…} references in the package ID field, and the project has deployed a package with this name before.”

What;s the best way to fix this and clear up disk space?

Hi Ian,

Thanks for getting in touch. I’m afraid that once you start using Variable Expressions #{} in the Package ID field it becomes very hard for Octopus to figure out what Packages to keep/delete. When it comes to Retention we want Octopus to be safe-by-default, so in this case you will need to implement your own Package retention.

Retention policy Tentacle cleanup and troubleshooting is worth a quick read.

There are several useful Script Templates in the Library that may be useful to you.

But I think you’re most likely to be best off running a PowerShell script on your Tentacles after the deployment is completed to clean up Packages according to your custom retention policy.

Hope that helps!