gerem
gerem

Reputation: 11

Azure DevOps predefined variables

I need to use a predefined Azure DevOps variable in a release pipeline. I'm working with several artifacts, and I need to get project name from each.

So, in an Inline PowerShell step, I try to use

RELEASE_ARTIFACTS_{ARTEFACTNAME}_PROJECTNAME

But the interpolation doesn't work as wanted .. I tried following without success:

$ProjectName = $("RELEASE.ARTIFACTS.$($var.name).PROJECTNAME")

Unfortunately, the result is always

"RELEASE.ARTIFACTS.varname.PROJECTNAME" and not the ADO project name

Upvotes: 0

Views: 714

Answers (1)

Levi Lu-MSFT
Levi Lu-MSFT

Reputation: 30343

You may have to hard code the artifacts alias name in the expression.

#REPOS1 is the artifacts alias defined in release pipeline Artifacts-->Source alias

$ProjectName = $(Release.Artifacts.REPOS1.ProjectName) 

You cannot wrap another $() inside $() like this $(a.$(b).c) in azure pipelines. Azure pipeline cannot resolve this kind expression $($()).

Below expressions will not work:

$alias = "Artifacts1"
$ProjectName = $(Release.Artifacts.$($alias).ProjectName)

$ProjectName = $(Release.Artifacts.$(arifactName).ProjectName)

Upvotes: 1

Related Questions