pulumi / pulumi-az-pipelines-task

Azure Pipelines task extension for running Pulumi apps.
https://marketplace.visualstudio.com/publishers/pulumi
Apache License 2.0
27 stars 19 forks source link

Variable expansion does not appear to work for the "stack" field #39

Closed joshsten closed 4 years ago

joshsten commented 4 years ago

image

I would expect this to pass the value of the variable down to the pulumi command as other fields other do, but for some reason in this case it passes the variable as is literally.

This is the yaml screenshot above, but the UI based tasks have the same result.

praneetloke commented 4 years ago

If I understand correctly, from your screenshot, $env:pullRequestShortName contains the name of yet another variable that actually has the value of the stack, correct?

joshsten commented 4 years ago

That's correct!

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch

If I understand correctly, from your screenshot, $env:pullRequestShortName contains the name of yet another variable that actually has the value of the stack, correct?

praneetloke commented 4 years ago

I just did a quick test and the following worked for me. I defined an outer variable with the value of $(inner), which holds the actual value I need:

Screen Shot 2020-02-07 at 13 33 01 Screen Shot 2020-02-07 at 13 33 08

However, when my outer variable's value itself is not an expression, it doesn't work. For example, this doesn't work for me:

Screen Shot 2020-02-07 at 13 33 24 Screen Shot 2020-02-07 at 13 33 38

Maybe the value of $env:pullRequestShortName in your case needs to be something $(anotherVar) and then your stackName input for the Pulumi task would just be: $(env:pullRequestShortName)? Can you please try that and see if that works? Also I am not sure if variable expansion would work with dynamically set variables; I haven't tried it myself and don't know if it does?

joshsten commented 4 years ago

That worked! I actually didn't need the env:

Sorry about taking your time. It appears it was my misusage. Thank you for the quick response.

praneetloke commented 4 years ago

Glad you were able to resolve it!