0
votes

I am trying to deploy multiple webjobs in a single release definition on VSTS.

My issue is that files contained in my webjobs can change (add/update/remove). By default, when a new version is deployed by using the task Azure app service deploy, no existing files are removed from the server. This result in deprecated files inside my webjob staying on my server and causing errors.

In order to fix my issue, I tried to enable the "Remove additional files at destination". But as I have to deploy each webjob in a separate task (Azure app service deploy supports only a single web package), each consecutive deployment deletes the files of the previously deployed webjob(s).

Any idea on how to solve this easily?

Currently my only guess is to Connect to web app through powershell and delete existing webjob with commandlet Remove-AzureWebsiteJob.
But my main concern with this is about deleting entire webjob(s) which I presume will also delete their logs and execution history...

1
use a powershell task to run these functions stackoverflow.com/questions/43801618/…vip32

1 Answers

1
votes

There is a way you can do this that is not well documented, by using the wawsdeploy tool.

After you get the tool from Chocolatey:

  • Download your apps's publishing profile form the Portal.
  • Go to the folder where you have the files you want to deploy for a specific WebJob.
  • Run: wawsdeploy . c:\folderwithyourprofile\YourApp.PublishSettings /t D:\home\site\wwwroot\App_Data\jobs\continuous\YourJob /d

Here, the /d causes it to delete all unknown files within that one folder, so it won't touch your other WebJobs. You can try running it first without the /d to get comfortable with the tool and make sure it puts files in the right place before it starts deleting things.

Note that it's possible to do similar things with just the msdeploy command line, but it's requires an extremely complex set of parameters. See my post for some details on this.