diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-07 03:08:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-07 03:08:24 +0300 |
commit | 967b999f2ee84d76a2c4d9618a6fe542a0dc1fb8 (patch) | |
tree | cf9512d03056beea678cda109a7e7aa8866d7375 /app/services/admin | |
parent | 069267811015e9f119326dfc47ecc13f9e47681a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/admin')
-rw-r--r-- | app/services/admin/propagate_integration_service.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/app/services/admin/propagate_integration_service.rb b/app/services/admin/propagate_integration_service.rb index 80e27c21d5b..96a6d861e47 100644 --- a/app/services/admin/propagate_integration_service.rb +++ b/app/services/admin/propagate_integration_service.rb @@ -7,8 +7,13 @@ module Admin def propagate update_inherited_integrations - create_integration_for_groups_without_integration if Feature.enabled?(:group_level_integrations) - create_integration_for_projects_without_integration + if integration.instance? + create_integration_for_groups_without_integration if Feature.enabled?(:group_level_integrations) + create_integration_for_projects_without_integration + else + create_integration_for_groups_without_integration_belonging_to_group + create_integration_for_projects_without_integration_belonging_to_group + end end private @@ -28,5 +33,19 @@ module Admin PropagateIntegrationGroupWorker.perform_async(integration.id, min_id, max_id) end end + + def create_integration_for_groups_without_integration_belonging_to_group + integration.group.descendants.without_integration(integration).each_batch(of: BATCH_SIZE) do |groups| + min_id, max_id = groups.pick("MIN(namespaces.id), MAX(namespaces.id)") + PropagateIntegrationGroupWorker.perform_async(integration.id, min_id, max_id) + end + end + + def create_integration_for_projects_without_integration_belonging_to_group + Project.without_integration(integration).in_namespace(integration.group.self_and_descendants).each_batch(of: BATCH_SIZE) do |projects| + min_id, max_id = projects.pick("MIN(projects.id), MAX(projects.id)") + PropagateIntegrationProjectWorker.perform_async(integration.id, min_id, max_id) + end + end end end |