Loading
Batch group lookups for inherited CI variables
What does this MR do and why?
Removes the per-row queries from getInheritedCiVariables, the query behind the inherited variables list on a project's CI/CD settings page.
groupNameandgroupCiCdSettingsPathloaded the variable's group and its route for every variable.groupCiCdSettingsPathalso checkedadmin_cicd_variableson each ancestor group separately, and each check read the organization, namespace settings, SAML provider and member access level.
Each group is now loaded once per request with its route, and Preloaders::GroupPolicyPreloader preloads the policy data for that batch.
Measured with the frontend query:
| Before (all / uncached) | After | |
|---|---|---|
| 2 groups, 2 variables | 24 / 18 | 19 |
| 5 groups, 25 variables | 85 / 30 | 19 |
Who sees groupCiCdSettingsPath does not change. The value is the same before and after for an owner of the root group only, a project maintainer, and a maintainer of the project's group.
References
Closes #629334 (closed)
How to validate
bundle exec rspec spec/requests/api/graphql/ci/inherited_ci_variables_spec.rb spec/graphql/types/ci/inherited_ci_variable_type_spec.rbThe new request example fails without the change to inherited_ci_variable_type.rb (25 → 54 queries).
Edited by Laura Montemayor