Skip to content

Add projects compliance standards adherence table

What does this MR do and why?

  1. Add project_compliance_standards_adherence table. This is the first step towards creating the compliance adherence report.
  2. 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.
  3. 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.

  1. Run bundle exec rails db:migrate
  2. Open psql and verify that the table is created image
  3. Run ComplianceManagement::Standards::Gitlab::PreventApprovalByAuthorService.new(<project_id>).execute and verify that a row inside project_compliance_standards_adherence table is created with correct values.
  4. Navigate to the project's general settings and toggle the "Prevent approval by author" check in merge request approval settings.
  5. 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.
  6. 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.

Edited by Huzaifa Iftikhar

Merge request reports

Loading