PreDeploy/Deploy/PostDeploy scripts automatically removed deployment?

Hello, for NuGet package steps deployed to custom directory Octopus used to copy (pre/post)deploy scripts to target directory. Today I’ve noticed that we don’t have these files in custom directory anymore. Has something changed at some point regarding Octopus copying these files to custom install directory?

Hi Dmitry,

Thanks for getting in touch.

Could you please let us know what version of Octopus you are running?

There was a fix in Octopus 3.2.10 regarding this variable: ‘OctopusDeleteScriptsOnCleanup’

If you want the PreDeploy/Deploy/PostDeploy etc scripts to remain, you will need to set that variable to ‘False’.

Hope this helps


Hi Mark,
I don’t think we need these scripts to remain, so cleaning is a good thing. We are just surprised to see that change - I don’t believe we’ve ever seen any announcement about it. Also, there is no such variables in this document:

Can this feature be somehow extended or controlled? Can we use it to cleanup other scripts as well? (sometimes we need to clean-up installation directory of some files we don’t need).

Hi Dmitry,

Good point. I’ve updated the documentation’s “User-modifiable settings” section so this is more obvious in the future.

If you’re installing to the same folder multiple times (where you’re installing a package to a custom installation directory), you can check the purge checkbox to cleanup the installation directory before your new package files are extracted. The variable above doesn’t clean up anything except the known Pre/Deploy/Post scripts. If this doesn’t do what you need, if you can make a case for a feature request, I’d recommend making a Uservoice suggestion. If it gets enough votes we’ll consider adding it in a future release :slight_smile:

Hope this helps.

Hi Mark, thanks! I think this is all we need!