Create background migration to create compliance standards adherence
What does this MR do and why?
- Creates a background migration to create compliance standards adherence records for projects in a group.
- Existing rows of the compliance standards table are not updated.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Check the number of rows for
project_compliance_standards_adherence
table by running the following in rails console
Projects::ComplianceStandards::Adherence.count
- Queue background migration by running
bundle exec rails db:migrate
- Verify that the batched background migration
CreateComplianceStandardsAdherence
is created by running the following in rails console.
Gitlab::Database::BackgroundMigration::BatchedMigration.find_by_job_class_name('CreateComplianceStandardsAdherence')
- Visit the background_migrations admin dashboard and verify that the background migration is completed successfully.
- Ensure that three rows inside
project_compliance_standards_adherence
table are created for every project that is in a group. We can run this (on GDK only since it's not a good query) to validate the same
group_projects_count = Project.for_group_and_its_subgroups(Group.all).count
compliance_standards_adherence_count = Projects::ComplianceStandards::Adherence.count
compliance_standards_adherence_count == 3 * group_projects_count # Ensure this is true
- Enable the following feature flags.
Feature.enable(:adherence_report_ui)
Feature.enable(:compliance_adherence_report)
- Visit the standards adherence dashboard and see that the dashboard has correct status for all the compliance checks.
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.
Closes #413235 (closed)