I have an Azure pipeline for a Blazor project and I'm trying to publish the results of the build to an Azure app service.
The build completes fine but the deploy task throws an error. At first I thought it was a problem with one of the paths in the pipeline. be
Eventually I checked the Azure logs and found this. This error is what led me to look at the zip file and its empty.
The pipeline artifact is fine. When its first created in the build, its also fine. But
moving from the build to deploy the zip is 0KB. My yaml file is below. If you look at the 2nd Stage which is "Dev", I'm doing an ls
just before that. I see what I expect
I do another list in the middle of deployment to Azure and its empty.
I haven't been able to find another issue like this anywhere but maybe I'm searching on the wrong keywords. Any help is greatly appreciated.
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
name: $(TeamProject)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:r)
stages:
- stage: 'Build'
jobs:
- job:
displayName: 'Build the application'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
restoreSolution: '$(solution)'
feedsToUse: config
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishPipelineArtifact@1
displayName: 'Publish to $(Pipeline.Workspace)'
inputs:
targetPath: '$(Pipeline.Workspace)'
artifactName: 'WebApp.zip'
- task: DownloadBuildArtifacts@1
displayName: 'Download Build Artifacts'
inputs:
buildType: current
project: 'HR3D Engineering'
pipeline: 'HR Taxonomy'
artifactName: 'WebApp.zip'
downloadPath: '$(System.ArtifactsDirectory)' #download to this folder.
- task: CmdLine@2
inputs:
script: 'ls -la $(System.ArtifactsDirectory)'
- stage: 'Dev'
displayName: 'Deploy to the dev environment'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deploy
pool:
vmImage: 'windows-latest'
environment: ChangeManagement-Dev
variables:
- group: Release
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: 'WebApp.zip'
- task: CmdLine@2
inputs:
script: 'ls -la D:\a\1\'
- task: AzureWebApp@1
displayName: 'Azure App Service Deploy: $(System.ArtifactsStagingDirectory)'
inputs:
azureSubscription: 'HR Data Governance(2442165c-339d-4e83-a443-a6583c372938)' #service connection name
appType: 'webAppLinux'
appName: 'HRChangeManagement-Dev' #app service name
package: 'D:\a\1\WebApp.zip'