0

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

enter image description here

Eventually I checked the Azure logs and found this. This error is what led me to look at the zip file and its empty.

enter image description here

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

enter image description here

I do another list in the middle of deployment to Azure and its empty. enter image description here

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'

1 Answer 1

0

Chris, 1.Enable diagnostics to get more information 2.Have you tried the Default value: $(System.DefaultWorkingDirectory)/**/*.zip.?

Per https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-v1?view=azure-pipelines#inputs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.