Allow filtering of projects by compliance filters
What does this MR do and why?
Adds compliance framework filter by id
How to set up and validate locally
- Create a group
- Create 3 projects, project_a project_b project_c
- Create two compliance frameworks for the group. refer https://docs.gitlab.com/ee/user/group/compliance_frameworks.html
- Add 1 compliance framework to project_a and another to project_b
- Test group search query with relevant gids
query SearchGroup {
group(fullPath: "YOUR_GROUP_PATH") {
name
projects(complianceFrameworkFilters:{id: "FRAMEWORK_GID"}) {
nodes {
id
complianceFrameworks {
edges {
node {
id
}
}
}
name
}
pageInfo {
endCursor
startCursor
hasNextPage
}
}
}
}
Query Plans
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15214/commands/52833
SQL
SELECT
projects.*
FROM
projects
INNER JOIN project_compliance_framework_settings compliance_framework_setting ON compliance_framework_setting.project_id = projects.id
WHERE
projects.namespace_id = 9970
AND compliance_framework_setting.framework_id = 1
PLAN
Nested Loop Anti Join (cost=0.73..88.91 rows=22 width=761) (actual time=0.087..1.487 rows=291 loops=1)
Buffers: shared hit=880
I/O Timings: read=0.000 write=0.000
-> Index Scan using index_projects_on_namespace_id_and_id on public.projects (cost=0.44..33.51 rows=22 width=761) (actual time=0.041..0.781 rows=291 loops=1)
Index Cond: (projects.namespace_id = 9970)
Buffers: shared hit=295
I/O Timings: read=0.000 write=0.000
-> Index Only Scan using index_project_compliance_framework_settings_on_project_id on public.project_compliance_framework_settings (cost=0.29..2.42 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=291)
Index Cond: (project_compliance_framework_settings.project_id = projects.id)
Heap Fetches: 0
Buffers: shared hit=585
I/O Timings: read=0.000 write=0.000
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 #388188 (closed)
Edited by Harsimar Sandhu