Problem
Attempting to use the value of a variable as the index to a dictionary does not appear to work.
Example
#{Octopus.Action[#{DeploymentStepName}].Output.Package.InstallationDirectoryPath}
The output of this expression is the expression itself, which is the behavior when an expression cannot be resolved.
Question
I’d like to know if this behavior is supported, and if so, what the correct syntax is.
More details
In my particular case, I am creating a Step Template where DeploymentStepName is the name of one parameter (a dropdown list of prior step names, specifically), and I would like to set the value of #{Octopus.Action[#{DeploymentStepName}].Output.Package.InstallationDirectoryPath}
to another parameter that will be sent to the script. This expression, however, does not resolve; only specifying the literal name of the step in place of the variable does.
There are other values I would like to query in this template that come from the output of another step like this, so to keep things simpler and faster, I would like to be able to specify the target step once from a dropdown list (already have this working) and be finished configuring the step.
As a workaround, I’ve stopped sending in the path and now just send in DeploymentStepName where I use the $OctopusParameters powershell variable to resolve strings and look up values like so:
$OctopusParameters["Octopus.Action[$deploymentStepName].Output.Package.InstallationDirectoryPath"]
I’m wondering if this is a bit of an edge case, because I can’t seem to find anything on the web about it; perhaps it will be of some use to others if I ask here.