user989988
user989988

Reputation: 3736

YAML - DownloadPipelineArtifact@2 to download files with specific extension

I have a YAML file with a task to download the artifact:

- task: DownloadPipelineArtifact@2
  inputs:
    artifact: '$(Build.BuildNumber)_$(BuildConfiguration)'
    path: Service\ProjectName

Logs for this task:

Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/Hosts.Console.csproj
Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/bin/Debug/netcoreapp3.1/Hosts.Console.dll
Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/bin/Debug/netcoreapp3.1/Entities.dll
Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/bin/Debug/netcoreapp3.1/Hosts.Console.deps.json
Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/bin/Debug/netcoreapp3.1/Entities.pdb
Downloading: D:\a\1\s\Service\ProjectName\Hosts.Console/bin/Debug/netcoreapp3.1/Hosts.Console.exe

I only want to download files that end with .csproj

How do I update the task to perform that?

- task: DownloadPipelineArtifact@2
  inputs:
    artifact: '$(Build.BuildNumber)_$(BuildConfiguration)'
    #patterns:
    path: Service\ProjectName

Upvotes: 1

Views: 1710

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19381

You can use the patterns argument in the task.

patterns:(Optional) One or more file matching patterns (new line delimited) that limit which files get downloaded. More Information on file matching patterns. Argument aliases: itemPattern

For example: Given the pattern **/*.csproj.

Upvotes: 2

Related Questions