Project template variable overwritten project variable in untenanted deployment

Hi Octopus Team
We are using Octopus Version 2020.5.0
In our last Untenanted deployment we noticed that Variable defined in Project Template overwritten the Variable defined in Project Variable. As per our knowledge, Project Template variables should transpose only when we are deploying through Tenant.
As per your Octopus Tutorial:
Project templates allow you to specify variables that can have different values per tenant/environment combination.

Project Template Variable → DisplayVersion = “Default Value”
Project Variable → DisplayVersion=“22.07”

Untenanted deployment Transposed Value of DisplayVersion should be “22.07”
Tenanted deployment Transposed Value of DisplayVersion should be “Default Value”

But its not happening in our case. We always getting Default Value in both (Tenanted/Untenanted) deployments.

Hi @smathur,

Thank you for contacting Octopus Support.

I would recommend turning on variable logging, create and deploy a new release, then check the raw task log to confirm where the value is coming from for this variable.

We would also be happy to have a look at the logs for you as well. Here is a secure upload link if you would like to share your raw task log with variable logging enabled.

I look forward to hearing back from you.

Best Regards,

Hi @donny.bell
Thanks for your reply.
As per company policy it will be difficult for me to share logs.
However, I have followed the steps and found following events taking place.

Capturing Display Version from both Project Variable & Template Variable


Setting Value of only Template Variable

My question is that, If we are doing Untenanted deployment, Should Octopus consider Project Template Variable?

Hi @smathur,

Thank you for getting back to me. I completely understand regarding the logs. I appreciate the additional details you provided.

In this case, I would recommend using the Project Variable Preview to evaluate if the value being used in the Deployment is consistent with the Variable Preview according to the Environment, Tenant, Deployment Step and Deployment Target.

Let me know if the Variable Preview doesn’t match the Deployment at your earliest convenience.

Best Regards,

Hi @donny.bell
Project Variable Preview showing same result as I shown above.

Let me reframe my question again.

Suppose we have same variable defined in both “Project Variable” as well as “Template Variable”
Project Variable → DisplayVersion=“22.07”
Template Variable → DisplayVersion=“Default Value”
if we are doing un-tenanted deployment then will octopus replace Value of Project Variable with Value of Template variable?

Hi @smathur,

Thank you for getting back to me.

I tested this scenario in a local test environment. I was able to set a Project Variable as the same name as a Common Template variable with the values of Project and Tenant respectively. I deployed a simple write-host script referencing the Variable via tenanted/untenanted project. When I deployed untenanted, my Variable resolved as Project and when I deploy to my Tenant, my Variable resolved as Tenant.

I ran the same test with a Project Template with the same expected results. However, if you have a Common Template with Variable names overlapping a Project Template, it appears the Project Template values were taking precedent in my limited testing.

In my test environment, this scenario seems to be working as expected. If you have scoping or are linking variables to one another, this may change depending on the setup.

While I was unable to find a specific Github issue for what you are describing, we have had many bug fixes related to variables when comparing Octopus Server 2020.5.0 to our current 2022.2.7580 release.

It may be worth testing an upgrade to our latest version to see if the behavior is still persisting: Upgrading a modern version of Octopus - Octopus Deploy

If you have any additional questions, please don’t hesitate to reach out.

Best Regards,

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