语法
# Download build artifacts v1
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@1
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.
输入
buildType
-
下载由 生成的项目
string
。 必填。 允许的值:current
(当前生成)、specific
(特定生成)。 默认值:current
。
是下载当前生成生成的项目还是从特定生成生成的项目。
project
-
项目
string
。
buildType == specific
时是必需的。
要从中下载生成构件的项目。
specificBuildWithTriggering
-
适当时,请从触发生成下载项目。
boolean
。 可选。 当 buildType == specific
时使用。 默认值:false
。
如果 true
,此生成任务会尝试从触发生成下载项目。 如果没有从指定管道触发生成,它将从以下选项中指定的生成下载项目。
buildVersionToDownload
-
生成版本以下载
string
。
buildType == specific
时是必需的。 允许的值:latest
、latestFromBranch
(特定分支的最新版本和指定的生成标记)、specific
(特定版本)。 默认值:latest
。
指定要下载的内部版本。
- 选择
latest
下载最新的可用内部版本。 - 选择
latestFromBranch
下载由branchName
指定的分支和 由tags
指定的标记的最新可用内部版本。 - 选择
specific
下载由buildId
指定的内部版本。
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
。
从生成下载特定项目或特定文件。
- 当您
single
只需要由artifactName
- 当您需要所选构建的所有构件时,请选择
specific
(Specific files)
artifactName
-
项目名称
string
。
downloadType == single
时是必需的。
要下载的项目的名称。
itemPattern
-
匹配模式
string
。 默认值:**
。
指定要下载为多行微型模式的文件。 有关详细信息,请参阅 文件匹配模式参考。
如果选择 \*\*
选项,则默认模式 会跨生成中的所有项目下载所有文件。 若要下载项目删除中的所有文件,请使用 drop/**
。
downloadPath
-
目标目录
string
。 必填。 默认值:$(System.ArtifactsDirectory)
。
下载项目的代理计算机上的路径。
System.ArtifactsDirectory
有关 的详细信息,请参阅 在经典发布管道中使用变量。
cleanDestinationFolder
-
清理目标文件夹
boolean
。 默认值:false
。
在下载项目之前删除目标文件夹中的所有现有文件。
parallelizationLimit
-
并行化限制
string
。 默认值:8
。
要同时下载的文件数。
checkDownloadedFiles
-
检查下载的文件
boolean
。 默认值:false
。
如果 true
,此生成任务将检查是否已完全下载所有文件。
retryDownloadCount
-
重试计数
string
。 默认值:4
。
如果下载失败,则重试下载生成项目的次数。
extractTars
-
提取存储在 tar 存档中的所有文件
boolean
。
设置为 以 true
提取所有具有 .tar 扩展名的已下载文件。 这很有帮助,因为如果要保留 Unix 文件权限,则需要将构件文件打包到 tar 中。 在 Publish build artifacts 任务中启用StoreAsTar
该选项会自动将构件存储为 .tar 文件。
任务控制选项
除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性。
输出变量
注解
注释
Azure Pipelines 团队建议从 生成项目 升级到 管道项目 ,以获得更快的性能。