In VSTS, how can I reference a variable in the name of another variable? -
i have variable group contains deployment credentials environment, test_host
, test_token
etc. want able use values of these variables in release task don't want type in environment name (test) can change between environments.
how can reference test_host
variable using current environment name? i've tried $($(release.environmentname)_host)
results in string $(test_host)
being passed script. how resolve $(test_host)
?
note - trying pass these values powerhsell script in arguments field have -deployhost $($(release.environmentname)_host)
results in -deployhost $(test_host)
being executed.
update 1 whilst values passed powershell script, script within task group. if outside task group (just regular powershell task in release) works. when pass value task group parameter, fails. see logs below.
2017-08-24t12:58:50.5643742z generating script. 2017-08-24t12:58:50.7206133z formatted command: . 'c:\agent_work\r5\a\rcv\deploys\uxforms\deploy-touxforms.ps1' -targethost $(test_host) 2017-08-24t12:58:50.7206133z ##[command]"c:\windows\system32\windowspowershell\v1.0\powershell.exe" -nologo -noprofile -noninteractive -executionpolicy unrestricted -file "c:\agent_work\_temp\baf9f7b8-2de2-4760-8cfd-67cd530801ed.ps1" 2017-08-24t12:58:50.7206133z ##[error]test_host : term 'test_host' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ c:\agent_work\_temp\baf9f7b8-2de2-4760-8cfd-67cd530801ed.ps1:2 char:79 + . 'c:\agent_work\r5\a\rcv\deploys\uxforms\deploy-touxforms.ps1' -targethost $(te ... + ~~ + categoryinfo : objectnotfound: (test_host:string) [], parentcontainserrorrecordexception + fullyqualifiederrorid : commandnotfoundexception
thanks
recreated task groups , variables , works now.
wiki
Comments
Post a Comment