Uredi

Deli z drugimi prek


DownloadPackage@1 - Download package v1 task

Use this task to download a package from a package management feed in Azure Artifacts.

Syntax

# Download package v1
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@1
  inputs:
    packageType: 'nuget' # 'maven' | 'npm' | 'nuget' | 'pypi' | 'upack' | 'cargo'. Required. Package Type. Default: nuget.
    feed: # string. Required. Feed. 
    #view: # string. View. 
    definition: # string. Required. Package. 
    version: # string. Required. Version. 
    downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
  # Advanced
    #files: '**' # string. Optional. Use when packageType = maven || packageType = pypi || packageType = upack. Files. Default: **.
    #extract: true # boolean. Optional. Use when packageType = nuget || packageType = npm. Extract package contents. Default: true.
# Download package v1
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@1
  inputs:
    packageType: 'nuget' # 'maven' | 'npm' | 'nuget' | 'pypi' | 'upack'. Required. Package Type. Default: nuget.
    feed: # string. Required. Feed. 
    #view: # string. View. 
    definition: # string. Required. Package. 
    version: # string. Required. Version. 
    downloadPath: '$(System.ArtifactsDirectory)' # string. Required. Destination directory. Default: $(System.ArtifactsDirectory).
  # Advanced
    #files: '**' # string. Optional. Use when packageType = maven || packageType = pypi || packageType = upack. Files. Default: **.
    #extract: true # boolean. Optional. Use when packageType = nuget || packageType = npm. Extract package contents. Default: true.

Inputs

packageType - Package Type
string. Required. Allowed values: maven, npm, nuget, pypi (Python), upack (Universal), cargo. Default value: nuget.


packageType - Package Type
string. Required. Allowed values: maven, npm, nuget, pypi (Python), upack (Universal). Default value: nuget.


feed - Feed
string. Required.

For project-scoped feeds, the format is projectID/feedID. See the following remarks to learn how to get a feed or project ID, or learn how to use a project and feed name instead.


view - View
string.

Specifies a view that only uses versions promoted to that specific view.


definition - Package
string. Required.

If you don't find the package in the list, you can provide the package ID, which you can find using the instructions here.


version - Version
string. Required.

Specifies the version of the package. Use latest to download the latest version of the package at runtime. Use * to download the latest version of a package when packageType = upack.


files - Files
string. Optional. Use when packageType = maven || packageType = pypi || packageType = upack. Default value: **.

Specifies which files to download using file matching patterns.


extract - Extract package contents
boolean. Optional. Use when packageType = nuget || packageType = npm. Default value: true.

Extracts the package contents and contains the package archive in the artifact folder.


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

Specifies the path on the agent machine where the package is 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

Use this task to download a package from a package management feed in Azure Artifacts or TFS.

Note

Requires the Package Management extension.

How do I find the ID of the feed (or project) I want to download my artifact from

The get feed API can be used to retrieve the feed and project ID for your feed. The API is documented here.

Can I use the project or feed name instead of IDs

Yes, you can use the project or feed name in your definition. However, if your project or feed is renamed in the future, your task will also have to be updated, or it might fail.

Examples

Download a NuGet package from an organization-scoped feed and extract to destination directory

# Download an artifact with id 'cfe01b64-ded4-47b7-a569-2ac17cbcedbd' to $(System.ArtifactsDirectory)
- task: DownloadPackage@1
  inputs:
    packageType: 'nuget'
    feed: '6a60ef3b-e29f-41b6-9885-7874278baac7'
    definition: 'cfe01b64-ded4-47b7-a569-2ac17cbcedbd' # Can also be package name
    version: '1.0.0'
    extract: true
    downloadPath: '$(System.ArtifactsDirectory)'

Download a maven package from a project-scoped feed and download only pom files

# Download an artifact with name 'com.test:testpackage' to $(System.ArtifactsDirectory)
- task: DownloadPackage@1
  inputs:
    packageType: 'maven'
    feed: '132f5c2c-2aa0-475a-8b47-02c79617954b/c85e5de9-7b12-4cfd-9293-1b33cdff540e' # <projectId>/<feedId>
    definition: 'com.test:testpackage' 
    version: '1.0.0-snapshot' # Should be normalized version
    files: '*.pom'
    downloadPath: '$(System.ArtifactsDirectory)'

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.144.0 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.115.0 or greater
Task category Utility