Add environment scope to group CI variables API [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
Extends the existing group variables API to support
EE-only params, and allows setting the environment_scope
if the :group_scoped_ci_variables licensed feature is available.
If the feature is not available (pricing tier is not Premium or
higher), the param is silently removed and the update continues
without presenting an error to the user. This behaviour is the
same as when project level scoped variables were a premium feature.
New finder queries
Without environment:
SELECT
"ci_group_variables".*
FROM
"ci_group_variables"
WHERE
"ci_group_variables"."group_id" = 9970
AND "ci_group_variables"."key" = <key>
Index Scan using index_ci_group_variables_on_group_id_and_key_and_environment on public.ci_group_variables (cost=0.42..3.44 rows=1 width=222) (actual time=0.026..0.028 rows=1 loops=1)
Index Cond: ((ci_group_variables.group_id = 9970) AND ((ci_group_variables.key)::text = <key>::text))
Buffers: shared hit=4
With environment
SELECT
"ci_group_variables".*
FROM
"ci_group_variables"
WHERE
"ci_group_variables"."group_id" = 9970
AND "ci_group_variables"."key" = <key>
AND "ci_group_variables"."environment_scope" = 'production'
Index Scan using index_ci_group_variables_on_group_id_and_key_and_environment on public.ci_group_variables (cost=0.42..3.20 rows=1 width=222) (actual time=0.023..0.023 rows=0 loops=1)
Index Cond: ((ci_group_variables.group_id = 9970) AND ((ci_group_variables.key)::text = <key>::text) AND (ci_group_variables.environment_scope = 'production'::text))
Buffers: shared hit=3
Screenshots
There is one visible change - the environment scope is added to the "inherited variables" section (if the feature flag is enabled):
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because the changes are behind a feature flag.
-
- [-] Documentation (if required) - no visible changes
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Tiger Watson