Variable Run Condition with Previous Step Output Parameter

I’m having trouble connecting the dots on how to use an output parameter from “Step1” to be the passing run condition on “Step2”. Right now Step1 executes a C# script that sets an output variable to either “True” or “False” using the following syntax:

Octopus.SetVariable(“MyVariable”, “[False | True]”);

In Step2 run condition i’ve tried the following expressions:

#{Octopus.Action[Step1].Output.MyVariable} // always false
#{if Octopus.Action[Step1].Output.MyVariable}True#{/if} // always false
#{if Octopus.Action[Step1].Output.MyVariable == “True”} // always false

If I remove the condition and just have Step2 print the output variable value it prints the correct “True” or “False” so I know Step1 is setting the variable to my desired value. I just can’t seem to get the expression to evaluate correctly.

Any insight into what I am missing is greatly appreciated!

So I found a workaround by inserting a “bogus” step in between Step1 and now Step3. When I wrote out the variables and viewed the verbose logging it appears that the run condition expression for the next step is being evaluated prior to the output variables being updated. By inserting a step in between you can see that the output variable is updated and the expression is evaluated correctly prior to reaching step3.

To make a long story short… it appears the variable run condition can not be applied to the next step following the setting of the output parameter.

Is this expected?

Hi Brian,

Thanks for reaching out. You shouldn’t need that “Bogus” step to make this work. Is there any chance you can remove that step to go back to the previous non-working state and then follow these instructions to send us a full deployment log?

1) Add these 2 variables to your project

2) Create a new release (so the new variables take effect) and deploy it. If possible skip as many steps as you can and only leave step we are troubleshooting in order to avoid the noise in the log.

3) Send us the raw log of that deployment

Feel free to set this conversation as “Private” on the right side menu if you don’t want any info in your log shared publicly.

Best regards,