We have a project with configured variables sets, which contain scoped variables.
For example we have a variable setup as follows:
Variable: SYSTEM_A_PASSWORD Env: LIVE, Value: XXX
Variable: SYSTEM_A_PASSWORD Env: LIVE, Role: WEBAPP2, Value: YYY
This is a variable set which is shared across multiple projects.
Because of the way we have to do some of our infrastructure deployments we need to have a defined offline target, which needs to run for certain roles:
Target: Offline Roles: WEBAPP1, WEBAPP2, WEBAPP3…
When we do a variable preview of the value, including the environment (LIVE), target role (WEBAPP1) and deployment target (Offline) we are shown the variable should be set to XXX.
Upon doing the deployment we have found that WEBAPP1 has a value of YYY for SYSTEM_A_PASSWORD and not XXX as expected.
Our understanding is that this is the correct behaviour (because the Offline target has a WEBAPP2 role, which causes it to use the more specific value of the variable set). The preview window however would appear to be displaying incorrectly.
Would you be able to clarify if our understanding of how this works is correct, and then furthermore if there is actually a bug/issue in the variable preview (or that we are trying to do something which isn’t supported).
Thanks for getting in touch! That’s a great question, and I appreciate the level of detail you’ve provided. I’ve set up this exact scenario in my local instance, and sure enough I’m seeing the same behavior here. I initially felt like this was a bug as it sure seems misleading, though I’m not entirely sure and I’d like to bring this up with my team to get some more thoughts on this.
The wording in the preview page when no role is selected (“Variables scoped to roles are not currently shown”) implies that this preview page is filtering by variable scope (which makes sense since the value
XXX is scoped to a different role). It seems like it should’ve been able to see the machine you selected has more than that one role, and a specific variable value is scoped to that second role which will be used.
I’m sorry for the confusion here, but I’ll let you know after I speak about this with my team. Don’t hesitate to reach out if you have any questions or concerns in the meantime.
Thanks for getting back to me, I’m pleased you were able to recreate it
Be very interested to see what your findings are!
Thanks for keeping in touch! I’ve had a discussion with my team, and in short this looks to be a limitation with our deployment preview feature where it’s simply just not smart enough to calculate this. Since your target has other roles outside of that specified in the preview, it’s not taking that into account, causing the correct value based on its scoping to the other unspecified role to not be displayed.
That said, we certainly agree we should make this feature smarter, so I’ve raised an enhancement issue at the following link to be looked at.
I’m sorry for the confusion this misleading issue has caused. For now you would just need to specify the role that both the machine has and the variable value is scoped to in the preview.
I hope this helps for now, and please don’t hesitate to reach out if you have any further questions or concerns going forward!
Thanks, very interesting and informative.
Not a problem at all, glad that helped! Don’t hesitate to reach out if you have any questions or concerns going forward.