使用此工作來下載已儲存為已完成組建成品的檔案。
如果您使用 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
儲存組建成品來源的組建編號。
請注意,由於回溯相容性,此輸入會傳回 BuildId。 如需詳細資訊,請參閱 變數。
此工作會定義下列 輸出變數,您可以在下游步驟、作業和階段中取用這些變數。
BuildNumber
儲存組建成品來源的組建編號。
需求
要求 | 說明 |
---|---|
管線類型 | YAML、傳統組建、傳統版本 |
執行於 | Agent、DeploymentGroup |
需求 | 沒有 |
功能 | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 所有支援的代理程式版本。 |
工作類別 | 效用 |