3

So the way that we've structured our code is that we've got several projects in our solution that each have multiple webjobs. We've configured a manual way of releasing these multiple webjobs using the run.cmd files and copying over the pertinent run.cmd file to the root folder depending on which webjob we're trying to release.

I'm wondering if there is any way to do this via a build/release definition in Azure DevOps without having to tear apart the multiple webjobs into individual projects. These multiple webjobs also all live in the same App Service.

Michelle
  • 63
  • 1
  • 4

1 Answers1

3

What you have done is the simplest way at present, you could just clone the process in Azure DevOps Build/Release Pipeline. There is not any way to do this in Azure DevOps without having to tear apart the multiple webjobs into individual projects.

We've configured a manual way of releasing these multiple webjobs using the run.cmd files and copying over the pertinent run.cmd file to the root folder depending on which webjob we're trying to release.

For example, in your build solution step define (add some copy file step to copy necessary files) :-

  1. Visual Studio Build (Solution: ***.sln, MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\")

  2. Publish Build Artifacts (Path to Publish: $(build.artifactstagingdirectory); Artifact Name: drop; Artifact Type: Server)

Create a release definition for this build definition and add a task

  1. Azure App Service Deploy
  2. Select your Azure Subscription and App Service name;
  3. Select your Package or Folder: $(System.DefaultWorkingDirectory)**\WebJob1.zip

You can similary create another Azure App Service Deploy task for WebJob2.zip and deploy as many webjobs you want through a single build and release pipeline.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • So I would bundle each webjob into a zip file to deploy in the release definition? – Michelle Jul 16 '19 at 20:35
  • @Michelle No, you don't have to do this. You could also choose folder instead. Also take a look at this similar answer here: https://stackoverflow.com/a/47710965/5391065 – PatrickLu-MSFT Jul 17 '19 at 01:38
  • Okay, I've created a successful build/release system using your help! Thank you! I was also hoping to learn a bit more about what's going on under the hood here. From what I can tell, wejobs are just basically any folders that exist under the app_data/jobs/{triggered/continuous} path. Is that correct? With this in mind, it's possible to deploy multiple webjobs using only one App Service Deploy. But, I don't think that's good practice? Can you point me to some documentation on what's happening under the hood/good practices? Thank you!! – Michelle Jul 17 '19 at 17:46
  • Hi @Michelle Yes for only webjobs. Just create a directory and create folder structure App_Data/jobs/continuous/ inside that. Copy your web job content to folder structure you have created above. About this concept you could take a look at Ajay Kumar Yadav [MSFT] 's reply in this question. https://developercommunity.visualstudio.com/solutions/295671/view.html It's able to deploy multiple webjobs using only one App Service Deploy. For a good practices, it's better to keep webjob corresponding to each project just like the structure like Marina Liu - MSFT' reply in my prior comment. – PatrickLu-MSFT Jul 18 '19 at 07:02
  • Hi Patrick! Actually, there is another issue now that I've just now been able to circle back to. After using an automated release, the manual release script no longer works. The error it runs into is: "An error occurred when the request was processed on the remote computer. C:\Program Files\dotnet\sdk\2.1.507\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sd k.Publish.MSDeploy.targets(139,5): error : An error was encountered when processing operation 'Create Directory' on 'D: \home\site\wwwroot" – Michelle Jul 31 '19 at 22:01
  • Any ideas why this would happen? – Michelle Jul 31 '19 at 22:01
  • It also seems that I can no longer delete the webjob after using the automated deployment. I'm wondering if the release somehow makes it so the app service no longer has permissions to delete/create/alter things? – Michelle Jul 31 '19 at 22:03
  • @Michelle Thanks for your kindly feedback, Michelle. This seems to be a different issue. In order to get a more concreted idea of this issue, would appreciate you submit a new ticket to get better tracking experience. According to your shared errors and limited information. This may be permission related. Make sure your **build service account** have enough/corresponding permission. – PatrickLu-MSFT Aug 01 '19 at 08:41
  • @Michelle The error you encountered may happen if the server administrator has not authorized this operation for the user credentials you are using. (Without permission)(Search “Create Directory” in the following page would quickly locate to the corresponding solution) http://www.iis.net/learn/publish/troubleshooting-web-deploy/troubleshooting-common-problems-with-web-deploy Then cause you are not able to create or delete directory on target file path. Finally fail the build. – PatrickLu-MSFT Aug 01 '19 at 08:42
  • i have similar scenario where multiple webjob is to be deployed on same app service. Deployment is performed using azure pipeline. in logs i can see deployment of both webjob is succeded but can only see one webjob.. @Michelle. what can be the issue..? – user27178 May 20 '20 at 18:22