Download Pipeline Artifacts task
Use this task to download pipeline artifacts from earlier stages in this pipeline, or from another pipeline.
Note
For more information, including Azure CLI commands, see downloading artifacts.
YAML snippet
# Download pipeline artifacts
# Download build and pipeline artifacts
- task: DownloadPipelineArtifact@2
inputs:
#source: 'current' # Options: current, specific
#project: # Required when source == Specific
#pipeline: # Required when source == Specific
#preferTriggeringPipeline: false # Optional
#runVersion: 'latest' # Required when source == Specific# Options: latest, latestFromBranch, specific
#runBranch: 'refs/heads/master' # Required when source == Specific && RunVersion == LatestFromBranch
#runId: # Required when source == Specific && RunVersion == Specific
#tags: # Optional
#artifact: # Optional
#patterns: '**' # Optional
#path: '$(Pipeline.Workspace)'
Arguments
| Argument | Description |
|---|---|
sourceDownload artifacts produced by |
(Required) Download artifacts produced by the current pipeline run, or from a specific pipeline run. Options: current, specific Default value: current Argument aliases: buildType |
projectProject |
(Required) The project name or GUID from which to download the pipeline artifacts. |
pipelineBuild Pipeline |
(Required) The definition ID of the build pipeline. Argument aliases: definition |
preferTriggeringPipelineWhen appropriate, download artifacts from the triggering build |
(Optional) A boolean specifying whether to download artifacts from a triggering build. Default value: false Argument aliases: specificBuildWithTriggering |
runVersionBuild version to download |
(Required) Specifies which build version to download. Options: latest, latestFromBranch, specific Default value: latestArgument aliases: buildVersionToDownload |
runBranchBranch Name |
Specify to filter on branch/ref name. For example: refs/heads/develop. Default value: refs/heads/master Argument aliases: branchName |
runIdBuild |
(Required) The build from which to download the artifacts. For example: 1764 Argument aliases: pipelineId, buildId |
tagsBuild Tags |
(Optional) A comma-delimited list of tags. Only builds with these tags will be returned. |
allowPartiallySucceededBuildsDownload artifacts from partially succeeded builds |
(Optional) If checked, this build task will try to download artifacts whether the build is succeeded or partially succeeded Default value: false |
allowFailedBuildsDownload artifacts from failed builds |
(Optional) If checked, this build task will try to download artifacts whether the build is succeeded or failed Default value: false |
artifactArtifact Name |
(Optional) The name of the artifact to download. If left empty, all artifacts associated to the pipeline run will be downloaded. Argument aliases: artifactName |
patternsMatching Patterns |
(Optional) One or more file matching patterns (new line delimited) that limit which files get downloaded. More Information on file matching patterns Default value: ** Argument aliases: itemPattern |
pathDestination Directory |
(Required) Directory to download the artifact files. Can be relative to the pipeline workspace directory or absolute. If multi-download option is applied (by leaving an empty artifact name), a sub-directory will be created for each. See Artifacts in Azure Pipelines. Default value: $(Pipeline.Workspace) Argument aliases: targetPath, downloadPath |
checkDownloadedFilesCheck downloaded files |
(Optional) If checked, this build task will check that all files are fully downloaded. Default value: false |
retryDownloadCountRetry count |
(Optional) Number of times to retry downloading a build artifact if the download fails. Default value: 4 |
Note
If you want to consume artifacts as part of CI/CD flow, refer to the download shortcut here.
Examples
Download a specific artifact
# Download an artifact named 'WebApp' to 'bin' in $(Build.SourcesDirectory)
- task: DownloadPipelineArtifact@2
inputs:
artifact: 'WebApp'
path: $(Build.SourcesDirectory)/bin
Download artifacts from a specific project/pipeline
# Download artifacts from a specific pipeline.
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
project: 'FabrikamFiber'
pipeline: 12
runVersion: 'latest'
Download artifacts from a specific branch
# Download artifacts from a specific branch with a tag
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
project: 'FabrikamFiber'
pipeline: 12
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
tags: 'testTag'
Download an artifact from a specific build run
# Download an artifact named 'WebApp' from a specific build run to 'bin' in $(Build.SourcesDirectory)
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
artifact: 'WebApp'
path: $(Build.SourcesDirectory)/bin
project: 'FabrikamFiber'
pipeline: 12
runVersion: 'specific'
runId: 40
FAQ
How can I find the ID of the Pipeline I want to download an artifact from?
You can find the ID of the pipeline in the 'Pipeline variables'. The pipeline ID is the system.definitionId variable. You can also find it in the URL path.
Open source
This task is open source on GitHub. Feedback and contributions are welcome.