Propagate instance-level integration to groups
What does this MR do?
In !32331 (merged) we introduced the propagation of instance-level integrations to projects.
After adding the group_id
column to the services
table !38499 (merged), we can now save integrations that belongs to a group !39959 (merged).
This propagates instance-level integration settings to groups:
- Update inherited integrations (find all integrations inheriting from the instance-level integration)
- Create integration for all projects without integration
- Create integration for all groups without integration (new)
Group-level functionality &2543 is under a feature flag group_level_integration
.
SQL queries
The implementation is heavily based on the current code to find all projects without integration. https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/concerns/integration.rb#L19-31
EXPLAIN SELECT "namespaces"."id"
FROM "namespaces"
WHERE "namespaces"."type" = 'Group'
AND (NOT EXISTS
(SELECT 1
FROM "services"
WHERE (services.group_id = namespaces.id)
AND "services"."type" = 'JiraService'))
LIMIT 100;
Time: 19.535 ms
- planning: 0.434 ms
- execution: 19.101 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 3628 (~28.30 MiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Query plan: https://explain.depesz.com/s/iuPp
Related to #209831 (closed)