Add projects compliance standards adherence table
What does this MR do and why?
- Add
project_compliance_standards_adherence
table. This is the first step towards creating the compliance adherence report. - To clarify how the new table would be used I've created
ComplianceManagement::Standards::Gitlab::PreventApprovalByAuthorService
which will be used in subsequent MRs to implement the issue #413233 (closed) where we'll be running this service against all the eligible projects and store whether it adheres to the 'prevent approval by author' rule which is part of the GitLab compliance standard. - This issue closes #413226 (closed) and implements some basic work for #413233 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Run
bundle exec rails db:migrate
- Open
psql
and verify that the table is created - Run
ComplianceManagement::Standards::Gitlab::PreventApprovalByAuthorService.new(<project_id>).execute
and verify that a row insideproject_compliance_standards_adherence
table is created with correct values. - Navigate to the project's general settings and toggle the "Prevent approval by author" check in merge request approval settings.
- Re-execute the above service and validate that no new row is created and the existing row's
status
is updated to reflect the current state of the project's adherence to the 'prevent approval by author' rule. - Run the service for a non existent project id and verify that an appropriate error is returned.
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.
Edited by Huzaifa Iftikhar