Dynamic construction of Octopus variables within step templates

Hi,

I have a Custom template and I want to pass the following octopus variable:
#{Octopus.Action[Deploy OLSS_IM_CAR Package].Output.Package.InstallationDirectoryPath}

Is it possible to replace OLSS_IM_CAR with a Local octopus Variable?

Regards
B.

Hi,

You can do this in Octopus versions after 3.3.23. See https://octopus.com/docs/reference/variable-substitution-syntax#VariableSubstitutionSyntax-IndexReplacement for details. Note that the whole segment within the […] needs to be a single variable, but you can build that variable up from other variables.

So you could do something like,
Delare variables:
PackageName = "OLSS_IM_CAR"
ActionName = “Deploy #{PackageName} Package”

Then use:

#{Octopus.Action[#{ActionName}].Output.Package.InstallationDirectoryPath}

I hope that helps.
Mark