In a yml step template I’m using the DownloadPipelineArtifact@2 to download a specific artifact produced from my build pipeline.
Since the artifact is quite big and, depending on the cases, I don’t need all the whole artifact content, I’m providing the itemPattern property as input parameter to my step template and passing as it is to the DownloadPipelineArtifact@2 task to perform some filtering operations and speed up the build.
Below a simplified version of the step template I’ve implemented, called filteredDownloadArtifact:
parameters:
workingDirectoryTestPattern: '**'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download artifact'
inputs:
buildType: 'current'
artifactName: 'MyArtifact'
itemPattern: |
${{ parameters.workingDirectoryTestPattern }}
It seems it’s working fine when I provide just one pattern but I’m experiencing some issue when I provided multiple item patterns to be downloaded.
For example, in another yml step template I’ve a pwsh task used to determine which folders should be downloaded
- powershell: |
$workingDirectoryTestPattern = (("$(fileCollection)" -split ' ') | ForEach-Object {
$dllName = [System.IO.Path]::GetFileName($_)
$_.replace($dllName, '**')
}) -join "`r`n"
Write-Host "##vso[task.setvariable variable=_workingDirectoryTestPattern]$workingDirectoryTestPattern"
and then I consume the filteredDownloadArtifact this way:
- template: filteredDownloadArtifact.yml
parameters:
workingDirectoryTestPattern: |
$(_workingDirectoryTestPattern)
But it doesn’t seem to work. Only one item pattern is provided to my step template.
So, is there a different way to consume multiline parameters when passed to an Azure DevOps step template? Thanks