Azure DevOps Multi Stage Pipeline Error: No package found with specified pattern: /home/vsts/work/1/s/**/*.zip - How do I fix?

Azure DevOps Multi Stage Pipeline Error: No package found with specified pattern: /home/vsts/work/1/s/**/*.zip - How do I fix?

我有一个 Azure DevOps Build (yaml) 和 Release Pipeline (Classic) 成功部署到 Azure。

我正在尝试在多阶段 Yaml 管道中转换这两个单独的步骤。

在 Azure 应用服务部署任务 (AzureRmWebAppDeployment@4) 中,我收到以下错误:

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

下面是我的多阶段 Yaml 管道

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'

如有任何帮助/建议,我们将不胜感激。

在发布期间,它不会像这样工作。而不是使用路径“/home/vsts/work/1/a/.zip”,这个路径可以使用“$(System.DefaultWorkingDirectory)/_Releasepipelinename/drop/.zip”

因为是2个阶段,第二个阶段没有你在第一个阶段发布的文件,你需要下载。

您可以使用 Pipeline 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.

为当前 运行 发布(上传)工件:

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

在第二阶段,您下载神器:

steps:
- download: current
  artifact: drop

也可以用build artifacts实现,用DownloadBuildArtifacts@0任务下载。