Variable not recognized

Hi all,

I have an instance where I have a project that includes 2 variables sets. One of the sets contains global config values that are the same across all projects, and the other contains client-specific config values that are specific to the client, and finally there are a few project-specific variables that pertain to the individual project itself.

One of the global variables is not being included with the rest. I have other variables from the global set that are making it through the substitution. On top of not being replaced in the config file during deployment, it doesn’t appear in the the Variables->Preview section on the project at all. I can see the variable in the Variable->Library Sets section when I look at the set, but somewhere along the line it’s getting lost.

In the deployment log, other variables in the file are discovered and replaced, but I believe that this is related to the fact that Octopus isn’t “seeing” that variable from the set.

Thanks in advance!

Hi @bsharp,

Thanks for posting your question, and sorry to hear you’re seeing that unexpected behavior.

May I ask which version of Octopus server are you using?

I was wondering if you could provide me with a screenshot of the scoping you’ve assigned to the variables within the global set? I’m wondering if the one variable that isn’t working perhaps has a different scoping than the other, and this is possibly why one is working and the other isn’t. For example:

If the scoping looks consistent for the variables, then I was wondering if you could turn on variable logging and direct message me the deployment task log so I can review it? You can find out how to do this from the following doc, as well as some other tips on variable troubleshooting:

Looking forward to figuring out what’s causing this!

Best,

Happy Monday @patrick.smergut! Thank you for the help and sorry about the delay in getting back to you.

We’re on Octopus Cloud v2021.2 build 7428. The variables I was referring to do have different scoping; however to attempt to get around this I added the deployment target to the “databaseName” variable scope in a last-ditch attempt to get it working on Friday. The “DataDrive” variable is correctly substituted, and it also appears in the variable preview screen on the project. Even so, the databaseName variable doesn’t appear in the variables preview at all, which is what’s really confusing me. It should show up in that list with all its values, correct? This project is restricted to deploy to the “Test” environment and I’ve double-checked that the target is assigned to that environment.

I censored parts of the screenshot, but hopefully left enough for you to get the gist:


Full scope:

Thanks in advance!

Edit: I also looked at the Debug Problems with Octopus Variables page you linked and the databaseName variable doesn’t show up in the log after enabling OctopusPrintVariables and OctopusPrintEvaluatedVariables is enabled on the project.

Hi @bsharp,

Thank you for getting back to us.

May we have permission to log into your Octopus Cloud instance to have a quick look?

Let us know at your earliest convenience.

Best Regards,
Donny

@donny.bell would it be possible to set up a call and do a screen share?

Hi @bsharp,

Yes, we can do that. I’ll send you a link shortly via direct message to schedule a meeting, and we can take a look.

Best,
Patrick

1 Like

Hi @bsharp,

Thanks for joining the call with us, and I just wanted to follow up with a little more information that may be helpful for you and others in this situation.

As we discussed, variable scoping can be tricky and sometimes have confusing behavior when it comes to deployments. We have a blog that goes through some of this in detail and is worth reading to understand what specificity is and how it works:

In addition we have some good documentation on scoping that may also be helpful when troubleshooting issues like these:

I’m glad we were able to get you unblocked, and please let us know if you have any further questions!

Kind regards,
Patrick

1 Like