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:
Variable name: CustomName
Value: $(my-name-is-$(customer))
Result: We can use the format:$(variablename)
get the Nested variable value in the next task.