I've got template where I want to evaluate coalesce(${{ parameters.pipeline }}, $(System.DefinitionId)).
As far as I know, this is the proper syntax:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'specific'
project: '$(System.TeamProjectId)'
pipeline: $[ coalesce(${{ parameters.pipeline }}, $(System.DefinitionId)) ]
buildVersionToDownload: latestFromBranch
branchName: $[ coalesce(${{ parameters.branchName }}, $(Build.SourceBranch)) ]
allowPartiallySucceededBuilds: true
downloadType: 'single'
downloadPath: '$(Pipeline.Workspace)'
artifactName: ${{ parameters.artifact }}
However, when I run this, I get this error:
Definition name $[ coalesce(141, 342) ] didn't correspond to a valid definition
I think this likely means that it's not evaluating the expression and using the literal string '$[ coalesce(141, 342) ]'.
It seems that Build.DefinitionId is only available at runtime, else I'd set the parameter default to ${{ Build.DefinitionId }}, and just set pipeline: ${{ parameters.pipeline }}.
I've tried a dozen different variants using $[ ], ${{ }}, and $( ) syntaxes both inside and outside the coalesce(). None of them work, but this one is the closest since it actually substitutes the variables in correctly.
Any ideas?