Overriding default deployment behaviour when targeting azure

I have a project that deploys to an Azure WebApp for the production release. one of the steps in the process is to deploy a nuget package (which is not a website, but rather a webjob) with a custom Deploy.ps1 script: that when executed would correctly deploy the webjob to the right path in azure. the problem is that Octopus, despite me providing the custom Deploy script, and it executing it, still tries to synchronize the nuget package content using msdeploy and replace the website root folder, which fails.

I would’ve expected that providing a custom Deploy.ps1 script would override/skip the default octopus deploy mechanism?

Hi Bishoy,

Thanks for getting in touch!

Providing a custom Deploy.ps1 file will not override the default deployment convention in Octopus, it is merely a mecahnism to give you an apportunity to run a custom script at deploy time (same as PreDeploy.ps1 and PostDeploy.ps1).

We have a fix waiting to be released which will allow you to retain existing files (i.e. not deleting files that are on the server but not in the NuGet package) when deploying to an Azure Web App, this fix will be part of v3.0.12 that should be released within the next day or so.

Hope that helps!

Thank you and kind regards,
Henrik

Thanks for the quick reply. Always above expectations :slight_smile:

However how it currently works, I’d personally prefer to have the option to
control this behavior by overriding or supplementing the default deployment
behavior with my own scripts. that comes valuable specially when deploying
a complex architecture of applications with each part having its unique
requirements that might not fall under the typical MsDeploy sync. so
instead of assuming it targets an Azure WebApp, then let’s synchronize it
with msdeploy, it should ask if that behavior is correct or there is a
custom deployment for this nuget package.

That’s a personal opinion, but I’m sure more users of your software would
share this opinion with me though.

Hi Bishoy,

We will be releasing an enhancement (GitHub Issue 1852) to the Azure Web App deployment functionality this morning (version 3.0.12) so that you can specify a couple of additional variables in your project to stop msdeploy from deleting files that are not part of your package (and also to not remove files from the App_Data folder). The variables are Octopus.Action.Azure.RemoveAdditionalFiles and Octopus.Action.Azure.PreserveAppData. So in your scenario you’d set the first of those variables to false and any additional files should be left on the server.

Hopefully this will help you get around your current issues when deploying your webjobs.

Thank you and warm regards,
Henrik