Add filtering by type to EnvironmentsFinder
What does this MR do and why?
Extracted from PoC for environments search (!86115 - closed)
I want to use EnvironmentsFinder in the EnvironmentsController. Controller supports filtering by type(to load the content of the folder), but finder doesn't.
(I don't use the finder in this MR, wanted to keep it as small as possible)
SQL query which will be used in the end
SELECT
"environments".*
FROM
"environments"
WHERE
"environments"."project_id" = 1
AND "environments"."environment_type" = 'review'
AND "environments"."name" ILIKE 'review/my\_review%'
AND ("environments"."state" IN ('available'))
Query Plan
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/11817/commands/41888
Index Scan using index_environments_on_project_id_state_environment_type on public.environments (cost=0.56..8.83 rows=1 width=164) (actual time=15.658..15.660 rows=0 loops=1)
Index Cond: ((environments.project_id = 1) AND ((environments.state)::text = 'available'::text) AND ((environments.environment_type)::text = 'review'::text))
Filter: ((environments.name)::text ~~* 'review/my\_review%'::text)
Rows Removed by Filter: 0
Buffers: shared read=4
I/O Timings: read=15.591 write=0.000
Screenshots or screen recordings
No visible changes to the user
How to set up and validate locally
Just run tests
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 #10754 (closed)
Edited by Huzaifa Iftikhar