แก้ไข

แชร์ผ่าน


DownloadBuildArtifacts@1 - Download build artifacts v1 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.

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.

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 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.

Specifies which version of the build to download.

  • Choose latest to download the latest available build version.
  • Choose latestFromBranch to download the latest available build version of the branch specified by branchName and tags specified by tags.
  • Choose specific to download the build version specified by buildId.

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.

  • Choose single (Specific artifact) when you want only one specific artifact specified by artifactName
  • Choose specific (Specific files) when you want all artifacts of the selected 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 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.

For more information on System.ArtifactsDirectory, see Use variables in Classic release pipelines.


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

Delete all existing files in destination folder before artifact download.


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.


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

Set to true to extract all downloaded files that have the .tar extension. This is helpful because you need to pack your artifact files into tar if you want to preserve Unix file permissions. Enabling the StoreAsTar option in the Publish build artifacts task will store 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 number of the build artifact source.

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

Remarks

Note

The Azure Pipelines team recommends upgrading from build artifacts to Pipeline Artifacts for faster performance.

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 2.191.1 or greater
Task category Utility