Using a variable in the 'step' part of an output variable reference

Hi folks,

We’ve set up 2 step templates. The first one creates an output variable.

The second takes a parameter where the control type is “A previous deployment step name”, which we’re using to refer back to the step where the output variable is set, in order to get that variable’s value.

Code snippet is as follows, where “OFFLINE_STEP_NAME” is the reference back to the step that sets the variable.

$OfflineStepName = “#{OFFLINE_STEP_NAME}”
$Condition = #{Octopus.Action[$OfflineStepName].Output.TestWeb}

The error we’re receiving:

Parsing script body with Octostache returned the following error: Parsing failure: unexpected '#'; expected end of input (Line 12, Column 14); recently consumed: ndition =

Is there any way to do this with a variable step name, or will we always have to ensure our step is given an identical name and hard-code that in the step template?

Figured it out by using the alternative format for getting at the parameter:

$ParameterName = "Octopus.Action[" + $OfflineStepName + "].Output.TestWeb
$Condition = $OctopusParameters[$ParameterName]

Hi @D.A.,

Glad you could find the right way to do this.

Cheers!
Dalmiro