Add service class to trigger external control
What does this MR do and why?
- Add service class to trigger external compliance requirement controls
- The corresponding project's
project_control_compliance_statuses
would be marked as "pending". - Currently, this service class is not being invoked any where in the code, however, in upcoming MRs we would be using this service class from a worker.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
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.
- Ensure you have ultimate license.
- For verification you need to create a compliance framework.
- You would also need to create at least one compliance requirement for this framework using the GraphQL API.
- You would also need to create at least one external control for the above compliance requirement. We do not support GraphQL API for this so you can use rails console for now.
cr = ComplianceManagement::ComplianceFramework::ComplianceRequirement.last
cr.compliance_requirements_controls.create!(control_type: 'external', name: "external_control", namespace_id: cr.namespace_id, external_url: "https://huzaifaiftikhar.requestcatcher.com", secret_token: "SECRET")
- Since this service is not exposed via an API or UI, we would need to use rails console for validation.
project = Project.find(20) # or any other existing project ID
framework = ComplianceManagement::Framework.last
cr = framework.compliance_requirements.last
control = cr.compliance_requirements_controls.last
ComplianceManagement::ComplianceFramework::ComplianceRequirements::TriggerExternalControlService.new(project, control).execute
- Ensure that the service returns a successful response and also the status of control in
project_control_compliance_statuses
is updated to 'pending'.
Closes #513421 (closed)
Edited by Huzaifa Iftikhar