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.
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.
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.
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
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.
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?
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.