Bug: Variables filtered on environment dont show vars with blank environment that was once populated

I’m on version 3.12.4

Repro steps:

  1. Create two variables
    1a. DummyVariable1 w/ Environment1
    1c. DummyVariable2 w/ NO ENVIRONMENT
  2. Save
  3. Filter on Environment1 - Both variables pass the filter (good)
  4. Clear the filters
  5. Remove Environment1 from DummyVariable1
  6. Save
  7. Filter on Environment1 - Only DummyVariable2 passes the filter (bad, both should show)

I have two concerns here. First, the bug needs to be fixed for the filtering. Second, can you tell me if the filtering still works correctly during a deployment? I mean, is this only a bug on the variables screen, or is this going to affect my deployments? I’m working on a massive deployment script and haven’t gotten to a point where I can test it yet.

Thank you,
Kevin

Here is your problem:

This does work, it shows when you filter on an environment

    {
      "Id": "42081763-2cc8-8403-db94-66b249e94bd1",
      "Name": "ESB-Website App Pool Name",
      "Type": "String",
      "Value": "myValue"
    }

This does not work, it will not show this variable when you filter on an environment. Note the Scope/Environment array.

{
      "Id": "70543d5a-abba-d503-ec75-a10ced6ebbf3",
      "Name": "ESB-Website App Pool Name",
      "Type": "String",
      "Value": "myValue",
      "Scope": {
        "Environment": []
      }
    }

Hi Kevin,

Thanks for getting in touch! Unfortunately you’ve hit an existing bug in Octopus. The good news is that it is only filtering that is broken and your deployments should work just fine.

At the moment we are not planning to fix it but we are working on the next version of Octopus UI and I documented your problem so we don’t forgot about it.

Regards,

Pawel

Really?? This is definitely not the response I was expecting. To me this is a critical issue. I have a deployment I’m working on which has 7 environments and hundreds of variables. Not being able to filter on variables for a given environment is going to make this darn near impossible to accomplish. And to top it off it has been known for 2.5 months? I’m disappointed. I know better than to tell a developer that a bug should be easy to fix…but this sure looks like one that is easy to fix.

Is there even a guesstimate for when it will be resolved?

Hi Kevin,

I apologize if it appeared I didn’t take your problem seriously. Let me assure you that I did and below is the reasoning behind our decision.

Variable Editor is a complex piece of code that hasn’t got enough attention in the past and became fragile. Even a conceptually simple fix is very time consuming and can easily introduce regressions. We have seen this happen quite a few times.

Taking all of this into account we have decided that Variable Editor needs a rewrite and we are planning to do it as part of our work on the new UI for Octopus v4. We don’t have any specific dates but we are looking at at least couple of months. You can check our progress here.

In the meantime I can offer a PowerShell script that will fix your existing data. Please, make sure you backup your database before you run this script.

Please let know if there is anything else I can do to help.

Regards,

Pawel

Thank you for putting together the PowerShell script. It should be pretty useful.