Self Managed instance generating new cloud license each sync
Bug
Summary
Customer is using a cloud license activation code on two separate instances. One instance has activated and installed one license; the other instance appears to be syncing and retrieving a new cloud license every day for the same subscription
customer ticket
customer account
subscription
instance activations
The server duplicating licenses is instance id 4632
#<SelfManagedInstanceActivation:0x00005608b3a21018
id: 4717,
created_at: Tue, 11 Oct 2022 11:30:05.625817000 UTC +00:00,
updated_at: Tue, 11 Oct 2022 11:30:05.639788000 UTC +00:00,
activated_at: Tue, 11 Oct 2022 11:30:05.639221000 UTC +00:00,
self_managed_instance_id: 4632,
cloud_activation_id: 12486>
#<SelfManagedInstance:0x00005608b3bdb598
id: 4632,
created_at: Tue, 11 Oct 2022 11:30:05.617226000 UTC +00:00,
updated_at: Tue, 11 Oct 2022 11:30:05.617226000 UTC +00:00,
instance_identifier: "dd942c34-9529-4bcb-829d-51f2707fa289">
#<SelfManagedInstanceActivation:0x00005608b595da08
id: 4727,
created_at: Tue, 11 Oct 2022 14:32:54.200416000 UTC +00:00,
updated_at: Tue, 11 Oct 2022 14:32:54.210432000 UTC +00:00,
activated_at: Tue, 11 Oct 2022 14:32:54.210054000 UTC +00:00,
self_managed_instance_id: 4642,
cloud_activation_id: 12486>
#<SelfManagedInstance:0x00005608b4cb99f0
id: 4642,
created_at: Tue, 11 Oct 2022 14:32:54.193613000 UTC +00:00,
updated_at: Tue, 11 Oct 2022 14:32:54.193613000 UTC +00:00,
instance_identifier: "f7e0452b-2be6-4a53-8b5c-68cf0696846f">
According to the most recent LicenseSeatLink
entries for each instance:
instance id 4642 is running GitLab 15.3.4-ee as of Wed, 26 Oct 2022 04:56:09.270189000 UTC
instance id 4632 is running GitLab 15.4.0-ee as of Wed, 26 Oct 2022 04:18:07.674231000 UTC
SelfManagedInstanceActivation.find(4717).licenses.count
=> 13
SelfManagedInstanceActivation.find(4727).licenses.count
=> 2
Steps to reproduce
Unsure
Relevant logs and/or screenshots
screenshot from customer's server with the duplicate licenses, taken roughly 2022-10-18
Workarounds
This is mostly cosmetic on the customer's side. On our side, it is generating superfluous licenses but otherwise causes no issues that I see
Reported examples
- https://gitlab.zendesk.com/agent/tickets/336444
- https://gitlab.zendesk.com/agent/tickets/340985
- https://gitlab.zendesk.com/agent/tickets/341699
- https://gitlab.zendesk.com/agent/tickets/339642
- https://gitlab.zendesk.com/agent/tickets/352894
- https://gitlab.zendesk.com/agent/tickets/372289
- https://gitlab.zendesk.com/agent/tickets/373382
Proposal
We could look into changing one of these two:
- Changing the callback from
before_validation
toafter_initialize
(relevant code) - Perform a
valid?
call on the new built license before comparing it to the most recent license (relevant code and this code).
- We could even consider calling the
valid?
in theLicense#equal_to?
method.