DownloadPackage@1 - 下载包 v1 任务
使用此任务从 Azure Artifacts 中的包管理源下载包。
语法
# Download package v1
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@1
inputs:
packageType: 'nuget' # 'maven' | 'npm' | 'nuget' | 'pypi' | 'upack' | 'cargo'. Required. Package Type. Default: nuget.
feed: # string. Required. Feed.
#view: # string. View.
definition: # string. Required. Package.
version: # string. Required. Version.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
# Advanced
#files: '**' # string. Optional. Use when packageType = maven || packageType = pypi || packageType = upack. Files. Default: **.
#extract: true # boolean. Optional. Use when packageType = nuget || packageType = npm. Extract package contents. Default: true.
# Download package v1
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@1
inputs:
packageType: 'nuget' # 'maven' | 'npm' | 'nuget' | 'pypi' | 'upack'. Required. Package Type. Default: nuget.
feed: # string. Required. Feed.
#view: # string. View.
definition: # string. Required. Package.
version: # string. Required. Version.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
# Advanced
#files: '**' # string. Optional. Use when packageType = maven || packageType = pypi || packageType = upack. Files. Default: **.
#extract: true # boolean. Optional. Use when packageType = nuget || packageType = npm. Extract package contents. Default: true.
输入
packageType
- 包类型
string
. 必需。 允许的值:maven
、npm
、 nuget
pypi
(Python) 、 upack
(通用) 。 cargo
默认值:nuget
。
packageType
- 包类型
string
. 必需。 允许的值:maven
、npm
、 nuget
pypi
(Python) 、 upack
(通用) 。 默认值:nuget
。
view
- 视图
string
.
指定仅使用升级到该特定视图的版本的视图。
version
- 版本
string
. 必需。
指定包的版本。 使用 latest
在运行时下载包的最新版本。
files
- 文件
string
. 可选。 在 时 packageType = maven || packageType = pypi || packageType = upack
使用 。 默认值:**
。
指定要使用文件 匹配模式下载的文件。
extract
- 提取包内容
boolean
. 可选。 在 时 packageType = nuget || packageType = npm
使用 。 默认值:true
。
提取包内容,并在项目文件夹中包含包存档。
downloadPath
- 目标目录
string
. 必需。 默认值:$(System.ArtifactsDirectory)
。
指定下载包的代理计算机上的路径。
任务控制选项
除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性。
输出变量
无。
备注
使用此任务从 Azure Artifacts 或 TFS 中的包管理源下载包。
注意
需要 包管理扩展。
如何实现查找要从中下载项目的源 (或项目的 ID)
获取源 API 可用于检索源的源和项目 ID。 此处记录了 API。
是否可以使用项目或源名称而不是 ID
是的,可以在定义中使用项目或源名称。 但是,如果项目或源在将来重命名,则你的任务也必须更新,否则可能会失败。
示例
从组织范围的源下载 NuGet 包,并将其提取到目标目录
# Download an artifact with id 'cfe01b64-ded4-47b7-a569-2ac17cbcedbd' to $(System.ArtifactsDirectory)
- task: DownloadPackage@1
inputs:
packageType: 'nuget'
feed: '6a60ef3b-e29f-41b6-9885-7874278baac7'
definition: 'cfe01b64-ded4-47b7-a569-2ac17cbcedbd' # Can also be package name
version: '1.0.0'
extract: true
downloadPath: '$(System.ArtifactsDirectory)'
从项目范围的源下载 maven 包,并仅下载 pom 文件
# Download an artifact with name 'com.test:testpackage' to $(System.ArtifactsDirectory)
- task: DownloadPackage@1
inputs:
packageType: 'maven'
feed: '132f5c2c-2aa0-475a-8b47-02c79617954b/c85e5de9-7b12-4cfd-9293-1b33cdff540e' # <projectId>/<feedId>
definition: 'com.test:testpackage'
version: '1.0.0-snapshot' # Should be normalized version
files: '*.pom'
downloadPath: '$(System.ArtifactsDirectory)'
要求
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈