DownloadBuildArtifacts@1 - 下載組建成品 v1 工作

使用此工作下載已儲存為已完成組建成品的檔案。

如果您使用Azure DevOps Services,建議您使用下載管線成品發佈管線成品,以加快效能。

Syntax

# 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 時為必要。

要從中下載組建成品的專案。


pipeline - 建置管線
輸入別名: definitionstring. 當 buildType == specific 時為必要。

指定組建管線名稱。


specificBuildWithTriggering - 適當時,請從觸發組建下載成品。
boolean. 選擇性。 使用 時機 buildType == specific 。 預設值:false

如果 true 為 ,則此建置工作會嘗試從觸發組建下載成品。 如果沒有從指定的管線觸發組建,它會從下列選項中指定的組建下載成品。


buildVersionToDownload - 要下載的組建版本
string. 當 buildType == specific 時為必要。 允許的值: latestlatestFromBranch (來自特定分支的最新版,以及指定的組建標籤) , 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 [ (特定檔案)

artifactName - 成品名稱
string. 當 downloadType == single 時為必要。

要下載的成品名稱。


itemPattern - 比對模式
string. 預設值:**

指定要下載為多行迷你配對模式的檔案。 如需詳細資訊,請參閱 檔案比對模式參考

如果您選擇 [特定檔案] 選項,預設模式 \*\* 會跨組建中的所有成品下載所有檔案。 若要下載成品卸載內的所有檔案,請使用 drop/**


downloadPath - 目的地目錄
string. 必要。 預設值:$(System.ArtifactsDirectory)

下載成品之代理程式電腦上的路徑。


cleanDestinationFolder - 清除目的地資料夾
boolean. 預設值:false

在成品下載之前,請先刪除目的地資料夾中的所有現有檔案。


parallelizationLimit - 平行處理限制
string. 預設值:8

要同時下載的檔案數目。


checkDownloadedFiles - 檢查下載的檔案
boolean. 預設值:false

如果 true 為 ,此建置工作會檢查是否已完整下載所有檔案。


retryDownloadCount - 重試計數
string. 預設值:4

如果下載失敗,重試下載組建成品的次數。


extractTars - 擷取儲存在 tar 封存內的所有檔案
boolean.

設定為 true ,以擷取所有具有 .tar 副檔名的下載檔案。 這很有説明,因為如果您想要保留 Unix 檔案許可權,您需要將成品檔案封裝到 tar。 啟用 StoreAsTar[發佈組建成品] 工作中 的選項會自動將成品儲存為 .tar 檔案。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性

輸出變數

此工作會定義下列 輸出變數,您可以在下游步驟、作業和階段中取用這些變數。

BuildNumber
儲存組建成品來源的組建編號。

請注意,此輸入會因為回溯相容性而傳回 BuildId 。 如需詳細資訊,請參閱 變數

備註

注意

Azure Pipelines 小組建議從 組建成品 升級至 管線成品 ,以加快效能。

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
在 上執行 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
可設定變數 任何
代理程式版本 2.191.1 或更新版本
工作類別 公用程式