使用此任务下载作为已完成生成的项目保存的文件。
如果使用 Azure DevOps Services,建议使用 下载管道项目 和 发布管道项目,以提高性能。
注释
如果使用 Azure DevOps Server 允许使用个人访问令牌进行身份验证,请禁用 IIS 基本身份验证。 有关更多详细信息,请参阅 IIS 基本身份验证和 PAT。
语法
# Download build artifacts v0
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType == specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when buildType == specific. When appropriate, download artifacts from the triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' | 'specific'. Required when buildType == specific. Build version to download. Default: latest.
#allowPartiallySucceededBuilds: false # boolean. Optional. Use when buildType == specific && buildVersionToDownload != specific. Download artifacts even from partially succeeded builds. Default: false.
#branchName: 'refs/heads/master' # string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Branch name. Default: refs/heads/master.
#buildId: # string. Required when buildType == specific && buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific && buildVersionToDownload != specific. Build Tags.
downloadType: 'single' # 'single' | 'specific'. Required. Download type. Default: single.
artifactName: # string. Required when downloadType == single. Artifact name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
#cleanDestinationFolder: false # boolean. Clean destination folder. Default: false.
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
#checkDownloadedFiles: false # boolean. Check downloaded files. Default: false.
#retryDownloadCount: '4' # string. Retry count. Default: 4.
#retryRedirectDownloadCount: '0' # string. Retry count for redirect download. Default: 0.
#extractTars: # boolean. Extract all files that are stored inside tar archives.
# Download build artifacts v0
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType == specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when buildType == specific. When appropriate, download artifacts from the triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' | 'specific'. Required when buildType == specific. Build version to download. Default: latest.
#allowPartiallySucceededBuilds: false # boolean. Optional. Use when buildType == specific && buildVersionToDownload != specific. Download artifacts even from partially succeeded builds. Default: false.
#branchName: 'refs/heads/master' # string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Branch name. Default: refs/heads/master.
#buildId: # string. Required when buildType == specific && buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific && buildVersionToDownload != specific. Build Tags.
downloadType: 'single' # 'single' | 'specific'. Required. Download type. Default: single.
artifactName: # string. Required when downloadType == single. Artifact name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
#cleanDestinationFolder: false # boolean. Clean destination folder. Default: false.
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
#checkDownloadedFiles: false # boolean. Check downloaded files. Default: false.
#retryDownloadCount: '4' # string. Retry count. Default: 4.
#extractTars: # boolean. Extract all files that are stored inside tar archives.
# Download build artifacts v0
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType == specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when buildType == specific. When appropriate, download artifacts from the triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' | 'specific'. Required when buildType == specific. Build version to download. Default: latest.
#allowPartiallySucceededBuilds: false # boolean. Optional. Use when buildType == specific && buildVersionToDownload != specific. Download artifacts even from partially succeeded builds. Default: false.
#branchName: 'refs/heads/master' # string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Branch name. Default: refs/heads/master.
#buildId: # string. Required when buildType == specific && buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific && buildVersionToDownload != specific. Build Tags.
downloadType: 'single' # 'single' | 'specific'. Required. Download type. Default: single.
artifactName: # string. Required when downloadType == single. Artifact name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
输入
buildType
-
下载由 生成的项目
string
。 必填。 允许的值:current
(当前生成)、specific
(特定生成)。 默认值:current
。
是下载当前生成生成的项目还是从特定生成生成的项目。
project
-
Project
string
。
buildType == specific
时是必需的。
要从中下载生成项目的项目。
pipeline
-
生成管道
输入别名:definition
。
string
。
buildType == specific
时是必需的。
指定生成管道名称。
specificBuildWithTriggering
-
适当时,请从触发生成下载项目。
boolean
。 可选。 当 buildType == specific
时使用。 默认值:false
。
如果 true
,此生成任务会尝试从触发生成下载项目。 如果没有从指定管道触发生成,它将从以下选项中指定的生成下载项目。
buildVersionToDownload
-
生成版本以下载
string
。
buildType == specific
时是必需的。 允许的值:latest
、latestFromBranch
(特定分支的最新版本和指定的生成标记)、specific
(特定版本)。 默认值:latest
。
allowPartiallySucceededBuilds
-
从部分成功的生成下载项目。
boolean
。 可选。 当 buildType == specific && buildVersionToDownload != specific
时使用。 默认值:false
。
如果 true
,则此生成任务会尝试下载项目,无论生成成功还是部分成功。
branchName
-
分支名称
string
。
buildType == specific && buildVersionToDownload == latestFromBranch
时是必需的。 默认值:refs/heads/master
。
指定是否筛选分支/ref 名称,例如:refs/heads/develop
。
buildId
-
生成
string
。
buildType == specific && buildVersionToDownload == specific
时是必需的。
要从中下载项目的生成。
tags
-
生成标记
string
。 可选。 当 buildType == specific && buildVersionToDownload != specific
时使用。
以逗号分隔的标记列表。 仅返回包含这些标记的生成。
downloadType
-
下载类型
string
。 必填。 允许的值:single
(特定项目)、specific
(特定文件)。 默认值:single
。
从生成下载特定项目或特定文件。
artifactName
-
项目名称
string
。
downloadType == single
时是必需的。
要下载的项目的名称。
itemPattern
-
匹配模式
string
。 默认值:**
。
指定要下载为多行微型模式的文件。 有关详细信息,请参阅 文件匹配模式参考。
如果选择 特定文件 选项,则默认模式 \*\*
会跨生成中的所有项目下载所有文件。 若要下载项目删除中的所有文件,请使用 drop/**
。
downloadPath
-
目标目录
string
。 必填。 默认值:$(System.ArtifactsDirectory)
。
下载项目的代理计算机上的路径。
cleanDestinationFolder
-
清理目标文件夹
boolean
。 默认值:false
。
在下载项目之前,删除目标文件夹中的所有现有文件。
parallelizationLimit
-
并行化限制
string
。 默认值:8
。
要同时下载的文件数。
checkDownloadedFiles
-
检查下载的文件
boolean
。 默认值:false
。
如果 true
,此生成任务将检查是否已完全下载所有文件。
retryDownloadCount
-
重试计数
string
。 默认值:4
。
如果下载失败,则重试下载生成项目的次数。
retryRedirectDownloadCount
-
重定向下载 重试计数
string
。 默认值:0
。
如果基于重定向的下载失败,则重试下载生成项目的次数( 可选)。 如果网络不允许遵循重定向,则可以将它设置为 -1 始终从 Azure DevOps 下载流式响应。
extractTars
-
提取存储在 tar 存档中的所有文件
boolean
。
提取具有 .tar
扩展名的所有已下载文件。 这非常有用,因为如果要保留 Unix 文件权限,则需要将项目文件打包到 .tar
文件中。 在 PublishBuildArtifacts 任务中启用 StoreAsTar
选项会自动将项目存储为 .tar
文件。
任务控制选项
除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性。
输出变量
此任务定义以下 输出变量,可以在下游步骤、作业和阶段中使用。
BuildNumber
存储生成项目源的内部版本号。