Home > database >  Unable to get the value of variable inside a variable in azure release pipeline
Unable to get the value of variable inside a variable in azure release pipeline

Time:01-06

I'm trying to use a variable inside variable in azure release pipelines.

i am using classic editor with bash extension for that. Bash task version is 3.*

input=my-name-is-$(customer)  
echo $input

$(customer) will be an user input provided when i create a release. ex: customer: foo
There is also a variable called my-name-is-foo: bar in the release pipeline associated variable group.

Current output is this:
my-name-is-foo

Expected output is this: bar

I have tried using
${{ input }} : bad substitution
$(${{ input }}) : bad substitution

In bash script, i know we can use something like

${!input}

which will get you the original value: bar
Is there any syntax that needs to be followed in azure release pipeline ?

CodePudding user response:

From your description, you need to use nested variable in Release Pipeline.

Example: $($(input))

I am afraid that there is no built-in method in release pipeline can achieve this.

To meet your requirement, you can use the Variable Set task from extension: enter image description here

Variable name: CustomName

Value: $(my-name-is-$(customer))

Result: We can use the format:$(variablename) get the Nested variable value in the next task.

enter image description here

  • Related