I'm trying to deploy a WebJob using Azure DevOps. I have the following pipeline:
pool:
# name: Hosted Windows 2019 with VS2019
vmImage: windows-2019
demands:
- msbuild
- visualstudio
- vstest
variables:
BuildPlatform: 'any cpu'
BuildConfiguration: 'release'
Parameters.solution: '**\*.sln'
steps:
- task: UseDotNet@2
displayName: 'Use Net Core 3.1.0'
inputs:
# packageType: 'runtime' # Options: runtime, sdk
packageType: 'sdk'
version: '3.1.100'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.7.0'
inputs:
versionSpec: 5.7.0
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: DotNetCoreCLI@2
displayName: 'net build'
inputs:
command: 'build'
projects: '**\*.csproj'
arguments: '--configuration Release'
- task: DotNetCoreCLI@2
displayName: 'net publish'
inputs:
command: 'publish'
publishWebProjects: false
projects: '**\*.csproj'
arguments: '--output $(Build.ArtifactStagingDirectory)\WebJob\App_Data\jobs\continuous\WJ_Channel_Fetch'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
inputs:
targetType: 'inline'
script: '"dotnet WJ_Channel_Fetch.dll" | Out-File run.cmd -Encoding ASCII; $LASTEXITCODE'
errorActionPreference: 'stop'
failOnStderr: false
ignoreLASTEXITCODE: false
pwsh: false
workingDirectory: '$(Build.ArtifactStagingDirectory)\WebJob\App_Data\jobs\continuous\WJ_Channel_Fetch'
- task: AzureAppServiceManage@0
displayName: 'Stop Azure App Service: XXXX-pipelines2'
inputs:
azureSubscription: 'Visual Studio Professional (**********)'
Action: 'Stop Azure App Service'
WebAppName: 'XXXX-pipelines2'
- task: AzureRmWebAppDeployment@3
displayName: 'Azure App Service Deploy: XXXX-pipelines2'
inputs:
azureSubscription: 'Visual Studio Professional (**********)'
WebAppName: 'XXXX-pipelines2'
Package: '$(Build.ArtifactStagingDirectory)\WebJob'
TakeAppOfflineFlag: true
- task: AzureAppServiceManage@0
displayName: 'Start Azure App Service: XXXX-pipelines2'
inputs:
azureSubscription: 'Visual Studio Professional (**********)'
Action: 'Start Azure App Service'
WebAppName: 'XXXX-pipelines2'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
condition: succeededOrFailed()
This works perfect, but I want to move the deploy part to a Release pipeline, so I can make use of the approvals between environments (DEV, QA, TEST, PROD).
The problem is that when I move it to a Release pipeline, the WebJob is deployed but it appears to be in an inconsistent state. I can't stop it, nor delete it; the only way to get rid of it is by deleting the WebApp. If I use only the YAML from above everything works.
This is my Release pipeline:
Any ideas? Many thanks in advance!
Solved the issue by downgrading the Azure App Service deploy task to version 3.*, that was also the difference between my YAML file and the Release pipeline I created using the GUI.
I still think it should work with the latest version, but for now I'm unblocked.