Debug problems with Octopus variables

Last updated

Sometimes a variable used during deployment may have a different value from the one you expect. Here are the first steps to debugging these issues.

Check the Variable Snapshot for the Release

  1. Open the Project ➜ Releases ➜ Release page for the Release you are debugging
  2. Scroll down to find the Variables section and click the Show link so see the snapshot of Variables being used by this Release.
  3. If the variable is wrong in the Snapshot:
    • Update the Variable, and then
    • Click the Update variables button - beware this will update all variables in the Snapshot to the latest values.

Check the variable value in the All Variables tab

  1. Open the Project ➜ Variables ➜ All Variables tab
  2. Investigate the variables from all possible sources for the project including the project itself, library variable sets, and tenants.

Did you know you can sort and filter all of the variables grids? Click the column heading to sort, or the filter icon to filter the variable grid.

Write the variables to the deployment log

This will log the variables available at the beginning of each step in the deployment as Verbose messages.

  1. Open the Project ➜ Variables page
  2. Set the following two variables:
Name Value
OctopusPrintVariables True
OctopusPrintEvaluatedVariables True

It should look like this. You can have as many extra variables as you want besides these two.

  1. Create a new release of the project or Update the variable snapshot for the release as shown above
  2. Deploy the new release
  3. Enable Verbose output on the Task log page
  4. Expand the element corresponding to the Tentacle on which the problem is observed. Two sets of variables will be printed, first, the raw definitions before any substitutions have been performed, then the result of evaluating all variables for deployment.

For debugging only
When adding these variables to your project, Octopus will add the following warning to your deployment log 20:30:45 Warning | OctopusPrintVariables is enabled. This should only be used for debugging problems with variables, and then disabled again for normal deployments. This is because printing variables increases the size of the task logs, and can make your deployments run slower. Don't forget to turn this off when you're finished debugging.