DownloadPackage@1 - 下載套件 v1 工作
使用此工作從 Azure Artifacts 中的套件管理摘要下載套件。
Syntax
# 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
(Universal) 、 cargo
。 預設值:nuget
。
packageType
- 套件類型
string
. 必要。 允許的值: maven
、、 npm
、 nuget
、 (pypi
Python) , upack
(Universal) 。 預設值: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 中的套件管理摘要下載套件。
注意
需要 套件管理延伸模組。
如何?尋找我想要從下載成品的摘要 (或專案識別碼)
取得摘要 API 可用來擷取摘要的摘要和專案識別碼。 API 記載 于此處。
我是否可以使用專案或摘要名稱,而不是識別碼
是,您可以在定義中使用專案或摘要名稱。 不過,如果您的專案或摘要在未來重新命名,則您的工作也必須更新,否則可能會失敗。
範例
從組織範圍的摘要下載 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)'
規格需求
需求 | 描述 |
---|---|
管線類型 | YAML、傳統組建、傳統版本 |
執行于 | Agent、DeploymentGroup |
要求 | 無 |
Capabilities | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 2.144.0 或更新版本 |
工作類別 | 公用程式 |
需求 | 描述 |
---|---|
管線類型 | YAML、傳統組建、傳統版本 |
執行于 | Agent、DeploymentGroup |
要求 | 無 |
Capabilities | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 2.115.0 或更新版本 |
工作類別 | 公用程式 |
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應