Consuming output variable set in child step


In a child step which is part of our database deployment process, I am setting an output variable. The child step name is “Verify success”.
Set-OctopusVariable -name "ContinueDeployment" -value $result sets the variable.
I am then attempting to read this variable from another step (a sibling of the child step’s parent)
if($OctopusParameters["Octopus.Action[Verify success].Output.ContinueDeployment"])

This doesn’t seem to work. I essentially have 2 questions:

  • Am I using the correct syntax?
  • Is what I’m trying to do even possible?

Any guidance would be great, thanks.

Hi Duncan,

Thanks for getting in touch! I gave this a test, and I’ve confirmed that you can set an output variable in a child step, and call it from a subsequent child step. I instead used simply write-host $OctopusParameters["Octopus.Action[Verify success].Output.ContinueDeployment"] to confirm this.

Calling it in the second child step using if($OctopusParameters["Octopus.Action[Verify success].Output.ContinueDeployment"]) throws this error:
Missing statement block after if ( condition )

We have some documentation on run conditions including an example of using output variables with the syntax which may help.

If you’re still hitting this issue, would you be able to provide a full verbose deployment log? The following doc page outlines producing and exporting this log.

Let me know how you go. :slight_smile:

Best regards,