I’m running into this exception during the application of the retention policy. After a deployment is complete, some additional work gets done that results in very deep paths under the deployment folder. This causes the tentacle to be unable to clean up the folder (the full exception is attached). This isn’t the same situation where the NuGet package code fails, this is purely .NET errors with long files. Two questions:
Are there any plans to fix this issue?
Is there some way to have a script or code be executed prior to the cleanup? If so, I could delete the deep paths manually.
exception.txt (4 KB)
Thanks for getting in touch! Could you please send through your DeploymentJournal.xml from the effected Tentacle so I can have a look at what information we have when trying to run the retention policy.
This should be found in: C:\Octopus<machine name>\DeploymentJournal.xml
We ended up using a pre/post deploy PowerShell script that shells out to cmd.exe to delete the folder. To repo, deploy a package to a custom folder (it happens with normal folders as well), and in a Post-Deploy, create some very long paths under the deploy folder (in our scenario, there is a zip file in the package that gets extracted to the deploy folder). Then, when the retention policy is applied, you will get the error.
It turns out that deleting very long paths from PowerShell isn’t easy at all. The only way I got it to work it to shell out to the old school del command, or using the Win32 API directly.
I have created an issue that you can track here: https://github.com/OctopusDeploy/Issues/issues/2532
Thanks for reporting this and giving the steps to replicate!