我在以下相同管道的不同工作中创建了一个档案
- task: ArchiveFiles@2
displayName: Archive conda build
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
includeRootFolder: true
archiveType: 'tar'
tarCompression: 'bz2'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(packageName)$(Build.BuildId).tar.bz2'
replaceExistingArchive: true
问题:
如何从管道的另一部分工作中下载我的存档文件$(packageName)$(Build.BuildId).tar.bz2'
?
答案 0 :(得分:1)
请检查Publish Pipeline Artifacts task和Publish and download artifacts
您将在一项作业中发布工件,然后在另一项作业中下载
。作业可能在不同的代理上运行,因此您需要将它们导出/导入到某种共享磁盘中。
以上步骤将帮助您实现这一目标。
这里有一个例子,看起来可能是这样:
stages:
- stage: A
jobs:
- job: JA
steps:
- pwsh: |
$content = 'Awesome artifact'
New-Item -Path $(Build.ArtifactStagingDirectory) -Name "testsummary.md" -ItemType "file" -Value $content
- publish: $(Build.ArtifactStagingDirectory)
artifact: someArtifact
- stage: B
dependsOn: A
jobs:
- job: JB
steps:
- download: current
artifact: someArtifact
- bash: ls '$(Pipeline.Workspace)/someArtifact'