[Bug] 'Ghost' environments when editing tenant project variables

Upgraded to 3.4.2
Enabled tenants
Added a project variable
Added tenant to all environments

When I go to the tenant project variables I see my two environments like so “ProjectName - Environment”. But I also see two ghost environments "Project Name- ".

What information should I provide?

When I go to ProjectName > All Variables I also see the same variable 4 times. Twice with the scope of the environment and twice without.

Hi!

Thanks for getting in touch. Could you provide some scrubbed screenshots of the Tenant -> Project/Environment connections, the Tenant’s Project Variables page, and the Project’s All Variables Page? If you’re able to get it, a copy of the tenant’s JSON from the database record would help also.

I’m really sorry you’ve run into this, we haven’t seen that kind of behaviour before, but I’m sure we’ll get to the bottom of it.

Hope that helps!
Mike

Attached are some screenshots. I’ll provide more info throughout the day.

Here’s the json so that explains something…

Note: I added one more environment since the screenshots.

{
“ProjectEnvironments”: {
“Projects-21”: [
“Environments-21”,
“Environments-22”,
“Environments-41”,
“Environments-43”,
“Environments-1”,
“Environments-42”,
“Environments-61”
]
},
“LogoAttachmentKey”: “Tenants-1”,
“LogoAttachmentMimeType”: “image/png”
}

The DeploymentEnvironment table only contains 3 rows. (Environments-1, Environments-42, Environments-61)

I just added a new Tenant and it only shows the environments as expected.

My guess is that the tenant and the environment do not get decoupled once I remove environments.

Guess that’s the downside of storing json data in a relational database :wink:

Hi,

Thanks for getting back to me with all that information - now it will be easy to fix! Yes, there are some really good benefits to the way we’re using SQL Server at the moment, but some nasty traps to fall into as well. :slight_smile:

I’ve raise an issue in GitHub for you to follow: https://github.com/OctopusDeploy/Issues/issues/2695

In the meantime you could safely edit that JSON to remove the ghost Environments, and then load your Tenant’s variables, and save them back. After that, everything should come back into shape.

Hope that helps!
Mike

Thanks!