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
- Open the Project ➜ Releases ➜ Release page for the Release you are debugging.
- Scroll down to find the Variables section and click the Show Snapshot link so see the snapshot of Variables being used by this Release.
- If the variable is wrong in the Snapshot:
- Update the Variable in the Variables section of the project, 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
- Open the Project ➜ Variables ➜ All Variables tab.
- 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 filter all of the variables grids? Click Show Advanced filters and select your filter type.
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.
- Open the Project ➜ Variables page.
- Set the following two variables:
It should look like this. You can have as many extra variables as you want besides these two.
- Create a new release of the project or Update the variable snapshot for the release as shown above.
- Deploy the new release.
- Enable Verbose output on the Task log page.
- 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. These variables are false by default.