Variable Substitution Specificity

We have run into a problem where what we think should be substituted and what the preview shows us differs from what actually gets transformed during variable substitution.
Setup
Our environment is configured like so:

We have the same machine with different roles which tie directly to deployable sites. We then created a variable with a general purpose (qat with just the 2 targets as seen below) and then a more specific variable targeted specific roles.

Before we added the inverse roles in red the substitution always returned qa even though each step was targeting a specific role. Once we added the opposing roles to the default value everything began working as expected. Curious if I misunderstood the Scope specificity section or if this is a true issue please. Regards.

Hi Chad,

Thanks for getting in touch,

I greatly appreciate your patience in addition to the time you have spent in clearly outlining this, this really helps out!

Based on the information provided in your query, the way I interpreted this was that previously the variable value of QAT had no scoping to roles, whereas QA contained scoping to both sotf admin & sotfweb, I can’t quite see from the screenshot, but I’m assuming that these two values belong to the same variable also.

In this event, the behavior I would expect to see would cause other Deploy Package steps in the Project that were scoped to other roles (i.e. ossweb, wares web) to perform Variable Substitution using QA as this value provides more specificty than QAT, it looks like you’ve recently added the rest of the roles to the appropriate variable value which I would expect to work as intended as Octopus is able to determine that QAT is to be used for ossweb since this scoping isnt present in QA.

In scenarios where the scoping of variables is identical in its specificity, Octopus will use the variable value which appears last in the value list, additionally.

I hope this helps!

If I’ve misunderstood your query in any way or missed something crucial, please let me know :slight_smile:

Have a great day!

Kind Regards,

Reece

Thank you very much for the run down. Not sure why it was happening but no matter what everything was being run through the qa variable. It wasn’t until we added the remaining roles that they began pulling their correct value of qat. My gut reaction was that since each of these roles were tied to the same target machine that it somehow how something to do with the weight calculation, but that was just a guess.

Hi Chad,

Thanks for getting back to me,

Not a problem! I’m glad to be of assistance.

If you require any further assistance in the future, please don’t hesitate to reach out :slight_smile:

Have a great day!

Kind Regards,

Reece

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