Skip to content

[BE] Add MergeRequest Violations CSV Export

What does this MR do and why?

Add backend for violations export: #356791 (closed)

Enable the user to request a CSV export of the merge request violations in the compliance dashboard. This export will be processed in the background and mailed to the the requesting user as an email attachment.

Screenshots

Screenshot_2023-06-16_at_15.49.11

How to set up and validate locally

  1. Run FILTER=compliance_report_violations bundle exec rake db:seed_fu to seed violations.
  2. Visit http://localhost:3000/groups/twitter/-/security/compliance_violation_reports.csv to trigger the export. (Adapt group path if necessary)
  3. Go to http://localhost:3000/rails/letter_opener/

MR acceptance checklist

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

Database

DatabaseLab - Query: Export MR Compliance Report: Run for GitLab Group(huge)

Time: 187.824 ms
  - planning: 1.500 ms
  - execution: 186.324 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 85818 (~670.50 MiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

DatabaseLab - Query: Export MR Compliance Report: Run for Sam's Test Group(small)

Time: 149.712 ms  
  - planning: 1.399 ms  
  - execution: 148.313 ms  
    - I/O read: 139.315 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 410 (~3.20 MiB) from the buffer pool  
  - reads: 59 (~472.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 2 (~16.00 KiB)  
  - writes: 0  
Edited by Sam Figueroa

Merge request reports