fix: Don't fetch environments on Admin variables page
What does this MR do and why?
A request to fetch environments would be sent on the Admin variables
page when the ci_variable_settings_graphql
FF is disabled, but that
doesn't make sense as we're not in a project context.
A system test started to fail recently because of an ambiguous match on alert boxes.
The fix is to only fetch environments if we're in a project's context.
Possibly related MRs are:
- !95624 (merged) (most likely this one)
- !89332 (merged)
- !94267 (merged)
- !98856 (merged)
Screenshots or screen recordings
Before
After
How to set up and validate locally
master
On - Ensure the
ci_variable_settings_graphql
feature flag is disabled (Feature.disable('ci_variable_settings_graphql')
) - Visit http://gdk.test:3000/admin/application_settings/ci_cd
- Notice the
There was an error fetching the environments information.
alert, similar to #376761 (closed) - You can inspect the XHR requests and notice a 404 request to
http://gdk.test:3000/api/v4/projects/undefined/environments
Alternatively, you can also just run bin/rspec './spec/features/admin_variables_spec.rb[1:1:1:10]'
, it should fail with the same error as #376761 (closed).
On this branch
- Ensure the
ci_variable_settings_graphql
feature flag is disabled (Feature.disable('ci_variable_settings_graphql')
) - Visit http://gdk.test:3000/admin/application_settings/ci_cd
- Notice there's no
There was an error fetching the environments information.
alert - You can inspect the XHR requests and shouldn't see any one to
http://gdk.test:3000/api/v4/projects/undefined/environments
Alternatively, you can also just run bin/rspec './spec/features/admin_variables_spec.rb[1:1:1:10]'
, it should pass.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #376761 (closed)