I am totally new to Azure, Pipelines, etc.
I am trying to create an App Service consisting of a web site and a WebJob (a background job that runs periodically). I want to build and deploy it using a Pipeline coded with a Yaml file.
I created a Visual Studio solution with a very simple ASP.Net Core web site (project "pipelines-dotnet-core"), and a simple .Net Core console program (project "WebJobsSDKSample").
I created the Yaml file to build, publish and deploy the web site to my App Service. This works fine and I can open the site in a browser.
I then extended the Yaml file to copy the output folder of the console program project to the publish folder of the web site, compress the result to a zip file and deploy that zip file. I understand that I have to copy the console program project output folder to /App_Data/jobs/triggered/app under the publish folder of the web site.
This new pipeline runs fine, and the web site still gets deployed correctly. However, when I open the WebJobs page of my App Service, it says "You haven't added any WebJobs".
The contents of my Yaml file is below. What do I need to change to correctly deploy the WebJob?
Also, if you could point me at clear examples of how to code a WebJob in a Yaml Pipeline file, that would be really helpful.
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration)'
zipAfterPublish: false
- task: CopyFiles@2
displayName: 'Copy Console App to WebJob Location'
inputs:
SourceFolder: WebJobsSDKSample/bin/Release/netcoreapp3.1
TargetFolder: pipelines-dotnet-core/bin/Release/netcoreapp2.2/publish/App_Data/jobs/triggered/app
- task: ArchiveFiles@2
displayName: 'Archive WebApp'
inputs:
rootFolderOrFile: pipelines-dotnet-core/bin/Release/netcoreapp2.2/publish
includeRootFolder: false
archiveFile: pipelines-dotnet-core/bin/Release/netcoreapp2.2/pipelines-dotnet-core.zip
- task: AzureWebApp@1
inputs:
azureSubscription: 'test connection 1'
appName: 'WebApplication120200310093243'
package: pipelines-dotnet-core/bin/Release/**/*.zip