1
votes

I have an Azure DevOps Build (yaml) and Release Pipeline (Classic) successfully deploying to Azure.

I am trying to convert these 2 separate steps in a Multi Stage Yaml Pipeline.

On the Azure App Service Deploy task (AzureRmWebAppDeployment@4), I am getting the following error:

No package found with specified pattern: /home/vsts/work/1/a/*.zip

Below is my Multi Stage Yaml Pipeline

stages:
  - stage: Build
    jobs:
    - job: 'Build'
      pool:
        vmImage: 'windows-latest'

      variables:
        buildConfiguration: 'Release'

      steps:
      - task: DotNetCoreCLI@2
        displayName: Restore
        inputs:
          command: restore
          projects: '**/*.csproj'
          vstsFeed: 'dd55642d-8943-411f-8856-9714dd0da8af'

      - task: DotNetCoreCLI@2
        displayName: Build
        inputs:
          projects: '**/*.csproj'
          arguments: '--configuration $(buildConfiguration)'

      - task: DotNetCoreCLI@2
        displayName: Test
        inputs:
          command: test
          projects: '**/*[Tt]ests/*.csproj'
          arguments: '--configuration $(buildConfiguration)'

      - task: DotNetCoreCLI@2
        displayName: Publish
        inputs:
          command: publish
          publishWebProjects: false
          projects: '**/Tools.Client.Blazor.ServerApp.csproj'
          arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'

      - task: PublishSymbols@2
        displayName: 'Publish symbols path'
        inputs:
          SearchPattern: '**\bin\**\*.pdb'
          PublishSymbols: false
        continueOnError: true

      - task: CopyFiles@2
        displayName: 'Copy Files to: $(build.artifactstagingdirectory)\AzureDeploy'
        inputs:
          SourceFolder: AzureDeploy
          TargetFolder: '$(build.artifactstagingdirectory)\AzureDeploy'

      - task: PublishBuildArtifacts@1
        displayName: 'Publish Artifact: drop'
        inputs:
          PathtoPublish: '$(build.artifactstagingdirectory)'
        condition: succeededOrFailed()
        
  - stage: Systest
    jobs:
    - job: 'Systest'
      variables:       
        resourceGroupName: '$(appName)-rg-$(environment)'
        location: 'East US'
        appServiceName: '$(appName)-svc-$(environment)'
        appInsightsName: '$(appName)-ins-$(environment)'
        appServicePlanName: '$(appName)-asp-$(environment)'
        appName: 'tools'
        owner: 'Pod'
        environment: 'systest'    

      steps:
      - task: AzureResourceManagerTemplateDeployment@3
        displayName: 'ARM Template deployment: Resource Group scope'
        inputs:
          azureResourceManagerConnection: 'Dev/Test Connection'
          subscriptionId: ''
          resourceGroupName: '$(resourceGroupName)'
          location: '$(location)'
          csmFile: '$(System.DefaultWorkingDirectory)/AzureDeploy/Tools.azureDeploy.json'
          csmParametersFile: '$(System.DefaultWorkingDirectory)/AzureDeploy/Tools.azureDeploy.parameter.json'
          overrideParameters: '-appServiceName "$(appServiceName)" -appInsightsName "$(appInsightsName)" -appServicePlanName "$(appServicePlanName)" -owner "$(owner)" -environment "$(environment)" -location "$(location)"'

      - task: AzureRmWebAppDeployment@4
        displayName: 'Azure App Service Deploy: $(appServiceName)'
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: ''
          appType: 'webApp'
          WebAppName: '$(appServiceName)'
          packageForLinux: '$(Build.ArtifactStagingDirectory)/*.zip'

Any help / suggestions would be appreciated.

2

2 Answers

3
votes

Because it's 2 stages the second stage doesn't have the file you published in the first stage, you need to download it.

You can use Pipeline artifacts instead of build artifacts.

Pipeline artifacts provide a way to share files between stages in a pipeline or between different pipelines. They are typically the output of a build process that needs to be consumed by another job or be deployed. Artifacts are associated with the run they were produced in and remain available after the run has completed.

To publish (upload) an artifact for the current run:

steps:
- publish: $(build.artifactstagingdirectory)
  artifact: drop

And in the second stage, you download the artifact:

steps:
- download: current
  artifact: drop

You can also achieve it with build artifacts and download with DownloadBuildArtifacts@0 task.

-3
votes

During Publish it will not work like this. Instead of using path "/home/vsts/work/1/a/.zip", this path can be used "$(System.DefaultWorkingDirectory)/_Releasepipelinename/drop/.zip"