Search code examples
powershelloctopus-deploy

Octopus Output Variables and Values


I'm looking through the Octopus powershell library and trying to identify a way to output all the variable names and their values used in a deployment - not the project overall, but only for a deployment.

So say I have 3 variables like the below

  • VariableOne Value1
  • VariableTwo Value2
  • VariableThree Value3

And I only use the first and third and want those printed with their names (VariableOne, VariableThree) and their values (Value1, Value3).


Solution

  • <TL;DR>

    No. It can't.


    It's something we tried as well, but Octopus Deploy has so many ways in which Variables can be used, from XPath to .config files, JsonPath to json files, direct references and inline scripts in the workflows as well as direct references in the #{var} syntax.

    None of these options track which variables were actually transformed or referenced, plus, some optional expansion may actually shortcircuit.

    I've asked Octopus whether they could actually extend the object model to detect the requests to the values of a variable, so we can see which values have actually been found. But that is currently not in place.

    And they came back with the problem that the step scripts may actually change or override the values of variables between steps, so the value may actually change during the workflow, making tracking them even harder.