If a tenant is deleted that failed in a release, that release will remain on the dashboard. I fixed it using the following SQL:
DELETE FROM Deployment WHERE TenantId NOT IN (SELECT Id FROM Tenant)
So it seems like a deployment is not removed correctly when a tenant is deleted.
Hi Jake,
Thanks for getting in touch! I think I’ve reproduced the behaviour you are seeing. We only delete deployments if you delete the Release or Project because the Deployment is also an historical artifact.
From the testing I’ve done the dashboard/project overview both work as I had expected if the deployment(s) for the deleted tenant are successful. However, if the deployment for the deleted tenant is not successful (any state other than successful) it incorrectly gets elevated instead of being filtered out.
I’ve created this GitHub Issue for you to watch: https://github.com/OctopusDeploy/Issues/issues/3088
In the meantime your workaround is a good one if you are happy to delete the tenant’s deployments.
Hope that helps!
Mike
Hi Jake,
I was working on another issue when I realised that deleting a Deployment
should also cascade delete some other records. The best way to do anything with Octopus is via the API since that will enforce our domain logic.
In this case where you have run that SQL script to delete deployments, I think the best way to clean up would be to run this additional SQL Script:
DELETE FROM DeploymentRelatedMachine WHERE DeploymentId NOT IN (SELECT Id FROM Deployment)
DELETE FROM VariableSet WHERE OwnerId LIKE 'Deployment-%' AND IsFrozen = 1 AND OwnerId NOT IN (SELECT Id FROM Deployment)
I’ve updated the GitHub issue with a C# API script as a workaround to clean up after deleting tenants.
Hope that helps!
Mike