共用方式為


DownloadBuildArtifacts@0 - 下載組建成品 v0 工作

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

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

注意

如果您使用 Azure DevOps Server 允許使用個人存取令牌進行驗證,請停用 IIS 基本身份驗證。 如需詳細資訊,請參閱 IIS 基本身份驗證和 PAT

下載組建成品。

Syntax

# 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.
# Download Build Artifacts v0
# Download Build Artifacts.
- 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.
    #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 - 專案
string. 當 buildType == specific 時為必要。

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


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

指定組建管線名稱。


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

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


buildVersionToDownload - 要下載的組建版本
string. 當 buildType == specific 時為必要。 允許的值: latestlatestFromBranch (來自特定分支的最新版,以及指定的組建標籤) , 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 檔案中。 啟用 StoreAsTar PublishBuildArtifacts 工作中的選項會自動將成品儲存為 .tar 檔案。


工作控制選項

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

輸出變數

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

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

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

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

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

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
Settable 變數 任何
代理程式版本 所有支援的代理程式版本。
工作類別 公用程式