Filter and Variable scoping issue

I’m trying to understand if I’ve encountered a bug or if it’s mean’t to be as designed.

Lets assume I have 3 environments. Dev, Test, Prod (The number really doesn’t matter)

I have a variable

MyVariable = avalue (No Scope) and Save.

Now I go to the filter in the Project Variables and Select Scope and Choose “DEV”

MyVariable is displayed.

Now if I edit the Variable and set it’s Scope to “DEV” and Save.

Now I go to the filter in the Project Variables and Select Scope and Choose “DEV”

MyVariable is displayed.

If I now go and edit the Variable one final time and Remove the Scope (X) and Save

Now I go to the filter in the Project Variables and Select Scope and Choose “DEV”

MyVariable is not displayed.

The only way to get this variable to show again is to delete it and create it again without ever having the scope applied.

Is this behaviour as expected?

Hi Paul,

Thanks for getting in touch! I’m sorry you’re hitting this unexpected behavior. Changing the scope on variables shouldn’t prevent the variable from being displayed. I haven’t been able to reproduce this, however I’m not positive I fully understand what you’re seeing. Could you provide some more information to ensure I test this accurately?

Would you be able to attach screenshots or a gif showing this behavior in action?
It could also come down to this user’s permissions. Could you provide an export of the permissions for this specific user as described in the following doc page?

I look forward to getting to the bottom of this one. :slight_smile:

Kind regards,

Kenny

The user doing this is in the System Adminstrator role.

Version: Octopus 3.15.6

In the attached Paint.Net File … Turn on each layer in order corresponding to the steps below.
Step 01: Create project - Select Variables
Step 02: Create variable (no Scope) Save
Step 03: No Filtering selected
Step 04: Select Filter Choose DV, Filter
Step 05: Variable Is Displayed
Step 06: Modify variable, select DV for Scope , Save
Step 07: Scope DV is now displayed in the variable List
Step 08: Select Filter Choose DV, Filter
Step 09: Variable Displayed with DV scope on Variable and Filter
Step 10: Modify variable that has the DV scope
Step 11: Remove the scope from Step 10. Apply
Step 12: Variable Displayed with No Scope now display but not Saved. Choose Save
Step 13: Variable Displayed with No Scope
Step 14: Select Filter, Choose DV , Filter
Step 15: Our Filter has applied, but our Variable no longer displays

FilterIssues.zip (362 KB)

Permissions_export_2017_09_12__04_38_42_UTC.csv (2 KB)

an additional thing i noticed when looking at the API.

A variable that is scope and then removed has a Scope : with an Empty array for the environment, whilst a variable that has never been scoped doesn’t have this issue.

{
  "Id": "variableset-Projects-61",
  "OwnerId": "Projects-61",
  "Version": 4,
  "Variables": [
    {
      "Id": "7827f97f-515d-de6d-9d87-0dda2aaff9ef",
      "Name": "MyVariable",
      "Value": "aValue",
      "Scope": {
        "Environment": []
      },
    },
    {
      "Id": "2aa98106-0d13-d5d6-7fa8-d9f3a510947c",
      "Name": "MyVariableNoScope",
      "Value": "1111",
      "Scope": {},
    }

Hi,

Thanks for following up with that additional information! I’ve been able to reproduce this issue where changing the scope of a variable while using the filter is causing the variable to not be displayed. In my case, it’s not actually deleting the variables but instead only failing to display them. Can you confirm if the variable still exists after refreshing the variables page without using the filter?

I’ve tested this in our new UI which is set for release in 4.0, where the issue seems to be resolved with the new variable editor. I appreciate you taking the time to report this, and I’m terribly sorry for the confusion caused by it. I’ve raised the following issue which you can track here.
https://github.com/OctopusDeploy/Issues/issues/3795

Let me know if you have any further questions going forward!

Kind regards,

Kenny

Yes, the variable still exists if the filter is not there. From what I can see it’s a UI/Save issue.

Hi Paul,

Thanks for confirming that - I’m happy to hear it’s not actually deleting the variables in your environment as well. It’s just a UI issue which will be resolved in 4.0. Thanks for taking the time to let us know about it, and I’m sorry for the confusion this has caused!

Don’t hesitate to reach out if you have any further questions or concerns in the future.

Kind regards,

Kenny