如何从 azure devops 中的另一个项目管道下载工件

问题描述 投票:0回答:1
trigger:
  - main

pool: 
  
  name: Default

steps:
- task: DownloadPipelineArtifact@2
  inputs:
    artifactName: "test_artifact"
    project: "Artifact_Demo"  # Specify the name of the project where the artifact is located
    pipeline: "source-pipeline"  # Specify the ID of the pipeline producing the artifact
    buildVersionToDownload: "latest"
    downloadType: "single"
    path: "$(System.ArtifactsDirectory)"
    targetPath: "$(System.ArtifactsDirectory)/test_artifact"

- powershell: |
    Get-ChildItem -Path "$(System.ArtifactsDirectory)\test_artifact" -Recurse
  displayName: 'List Contents of Downloaded Artifact'

Error

artifact_producing_pipeline

azure-devops azure-pipelines
1个回答
0
投票

该错误是由

DownloadPipelineArtifact@2
任务的参数不正确引起的。

要修复错误,请从另一个管道中选择工件,请单击任务上方的灰色

Settings
链接 -> 右侧,
simply manually choose
参数值 -> 单击底部的
Add
按钮覆盖任务内容。

任务可能是这样的(请按照上面的步骤修复任务内容):

- task: DownloadPipelineArtifact@2 
  inputs:
    buildType: 'specific'
    project: 'Artifact_Demo'
    definition: 'source-pipeline'
    buildVersionToDownload: 'latest'
    artifactName: 'test_artifact'
    targetPath: '$(System.ArtifactsDirectory)/test_artifact'

管道将获取目标工件:

© www.soinside.com 2019 - 2024. All rights reserved.