Редактиране

Споделяне чрез


DownloadPipelineArtifact@1 - Download pipeline artifact v1 task

Use this task to download pipeline artifacts from earlier stages in this pipeline, or from another pipeline.

There is a newer version of this task. For more information, see DownloadPipelineArtifact@2.

Note

For more information, including Azure CLI commands, see downloading artifacts.

Use this task to download pipeline artifacts from earlier stages in this pipeline, or from another pipeline.

Important

This task is supported on Azure DevOps Services only. If you use it on Azure DevOps Server, you'll receive an error message similar to Pipeline Artifact Task is not supported in on-premises. Please use Build Artifact Task instead. Use Download Build Artifacts if you're using Azure DevOps Server or TFS 2018.

Syntax

# Download Pipeline Artifacts v1
# Download a named artifact from a pipeline to a local path.
- task: DownloadPipelineArtifact@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.
    #branchName: 'refs/heads/master' # string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Branch name. Default: refs/heads/master.
    #pipelineId: # string. Alias: buildId. Required when buildType == specific && buildVersionToDownload == specific. Build. 
    #tags: # string. Optional. Use when buildType == specific && buildVersionToDownload != specific. Build Tags. 
    #artifactName: # string. Artifact name. 
    #itemPattern: '**' # string. Matching pattern. Default: **.
    targetPath: '$(System.ArtifactsDirectory)' # string. Alias: downloadPath. Required. Destination directory. Default: $(System.ArtifactsDirectory).
# Download Pipeline Artifacts v1
# Download Pipeline Artifact.
- task: DownloadPipelineArtifact@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.
    #branchName: 'refs/heads/master' # string. Required when buildType == specific && buildVersionToDownload == latestFromBranch. Branch name. Default: refs/heads/master.
    #pipelineId: # string. Alias: buildId. Required when buildType == specific && buildVersionToDownload == specific. Build. 
    #tags: # string. Optional. Use when buildType == specific && buildVersionToDownload != specific. Build Tags. 
    #artifactName: # string. Artifact name. 
    #itemPattern: '**' # string. Matching pattern. Default: **.
    targetPath: '$(System.ArtifactsDirectory)' # string. Alias: downloadPath. Required. Destination directory. Default: $(System.ArtifactsDirectory).

Inputs

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

Downloads artifacts produced by the current pipeline run or from a specific pipeline run.


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

Specifies the project name or GUID from which to download the pipeline artifacts.


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

The definition ID of the pipeline. In a running pipeline the definitionId can be found in the System.DefinitionId variable. The definitionId can also be retrieved from the URL on the pipeline overview page in the Azure DevOps portal. In the following URL example, the definitionId is 78: https://dev.azure.com/fabrikam-inc/FabrikamFiber/_build?definitionId=78&_a=summary. To download artifacts from a specific pipeline definition, capture the definitionId from that pipeline, and specify it as the pipeline parameter.


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

If checked, the task downloads artifacts from the triggering build. If there is no triggering build from the specified pipeline, the task 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 the build version to download.


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

Specifies the filter on the branch/ref name. For example: refs/heads/develop.


pipelineId - Build
Input alias: buildId. string. Required when buildType == specific && buildVersionToDownload == specific.

The identifier of the pipeline run from which to download the artifacts. In a running pipeline the buildId can be found in the Build.BuildId variable. The buildId can also be retrieved from the URL on the pipeline run summary page in the Azure DevOps portal. In the following URL example, the buildId is 1088: https://dev.azure.com/fabrikam-inc/FabrikamFiber/_build/results?buildId=1088&view=results. To download artifacts from a specific pipeline run, capture the buildId from that run, and specify it as the buildId parameter.


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

The comma-delimited list of tags that the task uses to return tagged builds. Untagged builds are not returned.


artifactName - Artifact name
string.

Specifies the name of the artifact to download. If the value is left empty, the task downloads all artifacts associated with the pipeline run.


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

The file matching patterns that limit downloaded files. The value can be one or more file matching patterns that are new line delimited. Learn more about file matching patterns.


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

The path on the agent machine where the artifacts will be downloaded.


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

None.

Remarks

There is a newer version of this task. For more information, see DownloadPipelineArtifact@2.

Important

This task is supported on Azure DevOps Services only. If you use it on Azure DevOps Server, you'll receive an error message similar to Pipeline Artifact Task is not supported in on-premises. Please use Build Artifact Task instead. Use Download Build Artifacts if you're using Azure DevOps Server or TFS 2018.

By default, artifacts are downloaded to $(Pipeline.Workspace). If you don't specify an artifact name, a subdirectory will be created for each downloaded artifact. You can use file matching patterns to limit the files you want to download.

How can I find the ID of the Pipeline I want to download an artifact from?

To find the definitionId for a specific pipeline definition

In a running pipeline, the definitionId can be found in the System.DefinitionId variable. The definitionId can also be retrieved from the URL on the pipeline overview page in the Azure DevOps portal. In the following URL example, the definitionId is 78: https://dev.azure.com/fabrikam-inc/FabrikamFiber/_build?definitionId=78&_a=summary. To download artifacts from a specific pipeline definition, capture the definitionId from that pipeline, and specify it as the pipeline parameter.

To find the buildId for a specific pipeline run

The identifier of the pipeline run from which to download the artifacts. In a running pipeline the buildId can be found in the Build.BuildId variable. The buildId can also be retrieved from the URL on the pipeline run summary page in the Azure DevOps portal. In the following URL example, the buildId is 1088: https://dev.azure.com/fabrikam-inc/FabrikamFiber/_build/results?buildId=1088&view=results. To download artifacts from a specific pipeline run, capture the buildId from that run, and specify it as the buildId parameter.

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.155.1 or greater
Task category Utility
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.150.3 or greater
Task category Utility