Azure DevOps CI/CD管道未找到错误

发布于 2025-02-12 04:25:36 字数 1693 浏览 2 评论 0原文

我有一个Azure DevOps CI/CD管道:

trigger:
- master
pool:
  vmImage: ubuntu-latest
variables:
  buildConfiguration: 'Release'
stages:
- stage: Build
  jobs:
  - job: Build
    displayName: 'Build'
    steps:
      - task: DotNetCoreCLI@2
        inputs:
          command: 'build'
          configuration: 'Release'
          projects: |
            $(System.DefaultWorkingDirectory)/src/*.csproj
          arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration $(buildConfiguration)
      - task: ArchiveFiles@2
        displayName: 'Archive files'
        inputs:
          rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
          includeRootFolder: false
          archiveType: zip
          archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
          replaceExistingArchive: true
      - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        artifact: drop
- stage: Test
  dependsOn: Build
  condition: succeeded()
  jobs:
    - job: Deploy
      displayName: 'Deploy to Test'
      steps:
      - task: AzureRmWebAppDeployment@4
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: 'xxx'
          appType: 'webApp'
          WebAppName: 'xxx'
          package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

当我运行它时,我会得到

Error: No package found with specified pattern: /home/vsts/work/1/drop/13325.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

构建阶段会产生一个工件,并且在“ drop”目录中,所以我无法将我的思想包裹在它上,为什么发布任务找不到它?

I have a Azure DevOps CI/CD pipeline:

trigger:
- master
pool:
  vmImage: ubuntu-latest
variables:
  buildConfiguration: 'Release'
stages:
- stage: Build
  jobs:
  - job: Build
    displayName: 'Build'
    steps:
      - task: DotNetCoreCLI@2
        inputs:
          command: 'build'
          configuration: 'Release'
          projects: |
            $(System.DefaultWorkingDirectory)/src/*.csproj
          arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration $(buildConfiguration)
      - task: ArchiveFiles@2
        displayName: 'Archive files'
        inputs:
          rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
          includeRootFolder: false
          archiveType: zip
          archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
          replaceExistingArchive: true
      - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        artifact: drop
- stage: Test
  dependsOn: Build
  condition: succeeded()
  jobs:
    - job: Deploy
      displayName: 'Deploy to Test'
      steps:
      - task: AzureRmWebAppDeployment@4
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: 'xxx'
          appType: 'webApp'
          WebAppName: 'xxx'
          package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

When I run it I get

Error: No package found with specified pattern: /home/vsts/work/1/drop/13325.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

The build stage produces an artifact, and it is in the 'drop' directory, so I can not wrap my mind around it why publish task can not find it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魄砕の薆 2025-02-19 04:25:36

正如@daniel指出的那样,您还需要在test阶段内下载工件任务,因为不同的阶段保持单独的工作目录。

- stage: Test
  dependsOn: Build
  condition: succeeded()
  jobs:
    - job: Deploy
      displayName: 'Deploy to Test'
      steps:
      - task: DownloadBuildArtifacts@1
        inputs:
          buildType: 'current'
          downloadType: 'single'
          artifactName: 'drop'
          downloadPath: '$(System.ArtifactsDirectory)'      
      - task: AzureRmWebAppDeployment@4
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: 'xxx'
          appType: 'webApp'
          WebAppName: 'xxx'
          package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

As @Daniel indicated you will also need a download artifacts task inside your Test stage as the different stages keep separate working directories.

- stage: Test
  dependsOn: Build
  condition: succeeded()
  jobs:
    - job: Deploy
      displayName: 'Deploy to Test'
      steps:
      - task: DownloadBuildArtifacts@1
        inputs:
          buildType: 'current'
          downloadType: 'single'
          artifactName: 'drop'
          downloadPath: '$(System.ArtifactsDirectory)'      
      - task: AzureRmWebAppDeployment@4
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: 'xxx'
          appType: 'webApp'
          WebAppName: 'xxx'
          package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文