DEV Community

Cover image for A tip for debugging Octopus Deploy variables
Ryan Rousseau for Octopus Deploy

Posted on • Originally published at blog.rousseau.dev

A tip for debugging Octopus Deploy variables

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, OctopusPrintVariables and 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

I configure OctopusPrintEvaluatedVariables to also prompt with the label Print Evaluated Variables?.

Image of prompted variable definition

The values will default to False. I can check the boxes during a deployment to turn on the debug logging only for that deployment.

Image of the create deployment screen showing prompted variables

Wrap-up

Combining prompted variables with OctopusPrintVariables and OctopusPrintEvaluatedVariables provides an easy way to debug your deployments' variable values.

This post was originally published at blog.rousseau.dev. Cover photo by Timothy Dykes on Unsplash.

Top comments (0)