I sometimes need to debug issues related to incorrect variable substitutions or filters in my deployments.
The Octopus docs have some tips on debugging problems with variables.
The third option, writing variables to the deployment log, is the one I use the most.
Writing variables to the deployment log
Octopus provides two system variables,
OctopusPrintEvaluatedVariables. Setting these variables to
True will write all variable values to the deployment log.
OctopusPrintVariables will write the unevaluated variable values to the log.
OctopusPrintEvaluatedVariables will write the fully evaluated variable values to the log.
I find these useful enough to keep them in the project. Before, I have left the values set to
False when not using them. I change them to
True when I need to debug other variables. The doc page mentions that you can update the variable snapshot on a release instead of creating a new release when adding or updating these variables.
I added a little extra to my configuration to avoid switching the values back and forth - prompted variables.
Conditionally writing debug logs with Prompted Variables
OctopusPrintEvaluatedVariables to also prompt with the label
Print Evaluated Variables?.
The values will default to
False. I can check the boxes during a deployment to turn on the debug logging only for that deployment.
Combining prompted variables with
OctopusPrintEvaluatedVariables provides an easy way to debug your deployments' variable values.