Variable Substitution with Tenant Tag Sets

ruf-u
(kphelan) #1

I am trying to figure out if what I am trying to do is possible or not, currently how I am doing it does not appear to work. I am trying to replace variables in a deployment with the following situation.

Multiple variables for the same Tenant & Environment, where one has a custom tenant tag assigned, one does not.

When I deploy to the environment but select the tenant tag, I would expect the most granular to be applied, but does not appear to be the case. It is applying the variable for that environment without the tenant tag. If I assign a different tenant tag to the other variable it works but I would expect it to go from most specific to least when applying variable substitutions. Is this not possible?

(Daniel Fischer) #3

Hi @kphelan,

Thanks for getting in touch! I’ll need to get some more information from you to get a better idea of what’s going wrong here.

Would you be able to attach a screenshot of your variables and scoping to better describe the issue you are encountering?

Our variable scoping specificity does take into account Tenant Tags, however as a note, scoping multiple Tenant Tags to a variable will not increase its specificity.

I initially opened this as a bug, however we internally decided it was technically expected behaviour due to the nature of Tenant tags.

This may not be the issue you are encountering though. If your issue is different, I’ll need to get some screenshots and details about the behaviour you are experiencing. :slight_smile:

Looking forward to hearing from you.

Best regards,
Daniel

(kphelan) #4

I sent an email reply but not sure if it went through so adding here as well:

We have the following Tenant Tag sets configured in our deployment environment.

Below is an example of a variable that is not getting transformed as expected. We setup this to contain multiple values and replace values in our appsettings.json file.

![image004|689x352]
(upload://4H9kdy0XrzJpchaKBdxMMkRYRYH.png)

And here is where it is configured in our project:

(kphelan) #5

When I do a deployment I would choose something like this, expecting that the value would be pulled from the variables that are tagged with the same deployment configuration tag, however it is taking the values that are simply tagged with the tenant tag of “Siepe”

(Daniel Fischer) #6

Hi @kphelan,

Thanks for getting back with the attached screenshots.

It does look like you are encountering the behaviour I illustrated in the previously linked GitHub Issue. This is technically working as expected. As the Tenant Tags are technically only used to define an association with a Tenant this behaviour, whilst a bit confusing, is working how we intend.

When you create a release for your Siepe-Demo Tenant and define the Core Portal (Admin) Tenant Tag, Octopus is resolving that Tag as the Tenant, so it is not able to identify a difference between your Core Portal (Admin) Tag and your Siepe tag, as a result, it selects the first value in the variables.

I initially assumed this was a bug when I raised the GitHub issue, however after a discussion with the developers, we came to the conclusion that this is expected behaviour as per our variable specificity and complexity blog post. The Tenant Tags in this instance are working the same as Machine Roles would work.

The values of the variable can not be more specific by multiple assignments of Tenant tags onto the same Tenant. So essentially, Tenant Tags can not work for scoping your multi-value variables in this way.

Does this make sense? If you have any questions at all here, please don’t hesitate to let me know.

Best regards,
Daniel