แก้ไข

แชร์ผ่าน


DownloadBuildArtifacts@0 - Download build artifacts v0 task

Use this task to download files that were saved as artifacts of a completed build.

If you're using Azure DevOps Services, we recommend using Download Pipeline Artifacts and Publish Pipeline Artifacts for faster performance.

Note

Disable IIS Basic Authentication if you are using Azure DevOps Server to allow authentication with your Personal Access Token. See IIS Basic Authentication and PATs for more details.

Download Build Artifacts.

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.

Inputs

buildType - Download artifacts produced by
string. Required. Allowed values: current (Current build), specific (Specific build). Default value: current.

Whether to download artifacts produced by the current build or from a specific build.


project - Project
string. Required when buildType == specific.

The project from which you want to download the build artifacts.


pipeline - Build pipeline
Input alias: definition. string. Required when buildType == specific.

Specifies the build pipeline name.


specificBuildWithTriggering - When appropriate, download artifacts from the triggering build.
boolean. Optional. Use when buildType == specific. Default value: false.

If true, this build task tries to download artifacts from the triggering build. If there is no triggering build from the specified pipeline, it downloads artifacts from the build specified in the options below.


buildVersionToDownload - Build version to download
string. Required when buildType == specific. Allowed values: latest, latestFromBranch (Latest from specific branch and specified Build Tags), specific (Specific version). Default value: latest.


allowPartiallySucceededBuilds - Download artifacts even from partially succeeded builds.
boolean. Optional. Use when buildType == specific && buildVersionToDownload != specific. Default value: false.

If true, this build task tries to download artifacts whether the build succeeds or partially succeeds.


branchName - Branch name
string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Default value: refs/heads/master.

Specifies whether to filter on branch/ref name, for example: refs/heads/develop.


buildId - Build
string. Required when buildType == specific && buildVersionToDownload == specific.

The build you want to download the artifacts from.


tags - Build Tags
string. Optional. Use when buildType == specific && buildVersionToDownload != specific.

A comma-delimited list of tags. Only builds with these tags are returned.


downloadType - Download type
string. Required. Allowed values: single (Specific artifact), specific (Specific files). Default value: single.

Downloads a specific artifact or specific files from the build.


artifactName - Artifact name
string. Required when downloadType == single.

The name of the artifact to download.


itemPattern - Matching pattern
string. Default value: **.

Specifies the files to download as a multi-line minimatch pattern. For more information, see File matching patterns reference.

The default pattern \*\* downloads all files across all artifacts in the build if you choose the Specific files option. To download all the files within the artifact drop, use drop/**.

.


downloadPath - Destination directory
string. Required. Default value: $(System.ArtifactsDirectory).

The path on the agent machine where the artifacts are downloaded.


cleanDestinationFolder - Clean destination folder
boolean. Default value: false.

Deletes all the existing files in the destination folder before the artifact is downloaded.


parallelizationLimit - Parallelization limit
string. Default value: 8.

The number of files to download simultaneously.


checkDownloadedFiles - Check downloaded files
boolean. Default value: false.

If true, this build task checks that all files are fully downloaded.


retryDownloadCount - Retry count
string. Default value: 4.

The number of times to retry downloading a build artifact if the download fails.


retryRedirectDownloadCount - Retry count for redirect download
string. Default value: 0.

Optional number of times to retry downloading a build artifact if the download based on redirect fails. If your network does not allow following the redirect, you can set this to -1 to always download streamed response from Azure DevOps instead.


extractTars - Extract all files that are stored inside tar archives
boolean.

Extracts all downloaded files that have a .tar extension. This is helpful because you need to pack your artifact files into a .tar file if you want to preserve Unix file permissions. Enabling the StoreAsTar option in the PublishBuildArtifacts task stores artifacts as .tar files automatically.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

BuildNumber
Stores the build artifact source's build number.

Please note that this input returns BuildId due to backward compatibility. For more information, see Variables.

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

BuildNumber
Stores the build artifact source's build number.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Utility