Skip to content

[Backend] Filter compliance violations by all protected branches

What does this MR do and why?

This MR adds the ability to filter compliance violations to merge requests that targeted protected branches for #358412 (closed).

This new filter input will be integrated with the frontend in #358414 (closed).

Screenshots or screen recordings

[GDK_HOST]/groups/gitlab-org/-/security/compliance_dashboard

image

No visual change.

How to set up and validate locally

You can apply the following patch to update the compliance report frontend to only show violations on protected branches:

diff --git a/ee/app/assets/javascripts/compliance_dashboard/utils.js b/ee/app/assets/javascripts/compliance_dashboard/utils.js
index 825632696a5..d5e77599090 100644
--- a/ee/app/assets/javascripts/compliance_dashboard/utils.js
+++ b/ee/app/assets/javascripts/compliance_dashboard/utils.js
@@ -12,6 +12,7 @@ export const convertProjectIdsToGraphQl = (projectIds) =>
   );
 
 export const parseViolationsQueryFilter = ({ mergedBefore, mergedAfter, projectIds }) => ({
+  targetsProtectedBranches: true,
   projectIds: projectIds ? convertProjectIdsToGraphQl(projectIds) : [],
   mergedBefore: formatDate(mergedBefore, ISO_SHORT_FORMAT),
   mergedAfter: formatDate(mergedAfter, ISO_SHORT_FORMAT),

ui.patch

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jiaan Louw

Merge request reports