Project variable templates - Default values

Hello,
We’ve had an issue recently with the variable template default values.

We had one old tenant with a very specific installation path variable value of ‘E:…’, for a project installation directory. (Let’s call it ‘MyGame’ to simplify)

Later, we decided to modify the default value for the project ‘MyGame’ installation directory variable template, with a more common value of ‘C:…’, that is more suitable for most of our tenants.

However, it seems the new default value we specified in the variable template has affected all the existing tenants/environments, including the old tenant that should retain the old ‘E:…’ value.

I’ve read the documentation, but I’m still unsure what is the expected behavior.

When you modify a default value in a variable template, will that new value overwrite all the existing tenant variables?
And can it be prevented? We would like to preserve the old values we specified in our old tenant.

Regards,
Damien

Hey Damien,

First of all welcome to the Forums!

Thanks for reaching out, this one does sound interesting.

Which version of Octopus Server are you running on?

Was the original default value E: ?

Could you please tell me in specific or show in screenshots the variables that you 1) Changed 2) Wanted to remain unchanged, but got overwritten by the new template variables?

I would like to reproduce this on my end, so if you have some detailed instructions to reproduce the issue, that would be very helpful.

Please let me know if you have any questions about the above.

Thanks,
Jeremy

Hi Jeremy,
Thanks for getting back to me.

We’re using Octopus 2019.13.7

Sorry about my poor explanation, I realize it’s a bit confusing.

I’ll try to summarize as best I can:

Our project situation:

Let’s call it ‘MyGame’.
This project has a variable template, called Service01.InstallationDirectory
The previous Default Value for that variable template was ‘E:\SomeFolder…’

The old Tenant/Project/Environment situation then: (Ill use fake names / fake projects)

MyOldTenant / MyGame / Production

So that old tenant had received the value ‘E:\SomeFolder…’
All was working correctly.

Then recently, I realized that default value, in our variable template (inside the ‘MyGame’ project) ‘E:\SomeFolder…’ was very problematic for all our new tenants, new servers etc.
The default value should be ‘C:\SomeFolder…’ for all future tenants.
I decided to modify this default value.

And then all hell broke lose, and some workmates were angry :wink:
The old tenant variable was overwritten with the new default value ‘C:\SomeFolder…’. We didn’t expect it.

I really didn’t expect a Default Value to be able to overwrite some previously configured tenants.

I confirmed it again with another project:

Changing a Default Value in a variable template will overwrite ALL previously configured tenant values.

Step to reproduce: (At least on our server):
-Add a tenant/project/env.
-Observe tenant variables. For instance: InstallationDirectory. It should have a value already. (E.g. 'E:\SomeFolder…)
-Modify the default value for InstallationDirectory in a project variable template.(With ‘C:\SomeFolder’)
-Observe the tenant InstallationDirectory variable again: It’s been overwritten with the new value. (Sadface)

Is that working as intended?

Ideally, we would like to do something similar to this: (Please forgive my pseudo code):

function update_project_variable_template()
for each tenant / env:
if (tenant variable IS NOT NULL)
do nothing
elseif (tenant variable is NULL)
update with default value

Regards,
Damien

Hi Damien,

Unfortunately for your use case, this is working as intended. The default values are used as a catch all variable that applies to all tenants so that you don’t need to upgrade possibly hundreds of tenants manually. For instance, a connection string. If you need to move the DB, you would just need to update the new default value.

In your case you would need to decide which is the “default” value(for instance, C:), then go to the other tenants and specifically set the others to E: within their specific tenant common variables.

Here are some examples:


In this case, the behavior will be any tenant that hasn’t specifically set a value for Install Directory for Test App will go to C:, but Tenant “Basic” will use E:.

Please let me know if this information helps or if you need further assistance.

Thanks,
Jeremy

Alright, that settles it then :slight_smile:

We’ll use the default value ‘C:’ for common cases, and ‘E:’ sporadically for edge cases.

Thank you for the very quick reply, much appreciated!

Regards,
Damien

1 Like

Hey Damien,

You’re very welcome. Sounds like a good plan.

Have a great rest of your week.

Thanks,