Display Runtime Variable Expression

Hi,

Is there a way to display my runtime variables to determine why my expression is not working properly? I am currently trying do a Run Condition variable expression to only run a step if the tentacle machine matches a specific tenant machine variable. Whenever I use == it skips the step but the values appear like they appear like they should be identical when I write both values out. Here’s my current expression.
#{if Octopus.Machine.Hostname == TenantServerName}true#{/if}

Thank you,
Dave

Hi @dgschmitz,

Welcome to the Octopus Forums!

To see all variables available to you in a script step, you will need to enable Variable Logging. Once you enable variable logging and run the deployment again, you can go to the Verbose/RAW log of the task and you should see all the variables available to you along with their values. Once you have fixed your issue we recommend turning it off because it can slow down deployments.

Please let me know if that gets your issue worked out or if you need more assistance.

Thanks,
Jeremy

Hi @jeremy.miller,

Thank you for your response. I tried turning on Variable Logging and read through the different variables available it did not show me what evaluation of the of the Run Condition for the step to run was evaluating out to.

Here are the two variables I’m attempting to evaluate:
[Octopus.Machine.Hostname] = ‘2016-octo-sql01’
[OperationalDatabaseServerName] = ‘2016-octo-sql01’

Based on the return of the two variables I’m using in my expression I would expect this to be not true
[Octopus.Action[Variable Test].ConditionVariableExpression] = ‘#{if Octopus.Machine.Hostname != OperationalDatabaseServerName}true#{/if}’

Ideally I want to change the expression to == but it currently skips the step when it’s set that way.

Hope this clarifies things,
Dave

Hi @dgschmitz,

It looks like you’re on the right track with your logic. Which version of Octopus Server are you running? This logic may not work unless you are on 2020.2.4 or above. Here is an issue describing the behavior we’re seeing: Github Issue 3206

If you are under 2020.2.4, are you able to upgrade and see if that resolves your issue?

Thanks,
Jeremy

Hi @jeremy.miller,

Thank you for sharing that link. The server was previously running 2020.1.17. I upgraded it to 2020.2.9 and re-ran it successfully resolving my issue.

Thanks,
Dave

1 Like

Hi @dgschmitz,

That’s awesome news. I’m glad the upgrade fixed it. Please feel free to reach out to us if you need any other assistance.

Thanks,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.