Unlink issues from compliance violation

What does this MR do and why?

Unlink issues with compliance violation

Changelog: added EE: true

How to set up and validate locally

  1. You need to have a group with Ultimate license.

  2. You need to have at least one project under the group, atleast one audit event related to the project.

  3. Also, have at least one compliance framework in the group, the framework should have atleast one compliance control.

  4. The framework should be applied to the project.

  5. Now create a compliance violation entry in the database by running following command in the rails console:

       ComplianceManagement::Projects::ComplianceViolation.create!(project_id: <project_id>, namespace_id: <namespace_id>, audit_event_id: <audit_event_id>, compliance_requirements_control_id: <compliance_requirements_control_id>, status: 0, audit_event_table_name: 0)
  6. Create at least one issue inside a project, and after that create the violation issue link by doing following:

       ComplianceManagement::Projects::ComplianceViolationIssue.create!(project_id: <project_id>, project_compliance_violation_id: <project_compliance_violation_id>, issue_id: <issue_id>)
  7. Now, run the following mutation to unlink the issue from the violation:

mutation unlinkViolationIssue {
  unlinkProjectComplianceViolationIssue(input: {
    violationId: "gid://gitlab/ComplianceManagement::Projects::ComplianceViolation/<id>",
    issueIid: "<iid>",
    projectPath: "<project_full_path>"
  }) {
    violation {
      id
      status
      issues {
        nodes {
          id
          title
        }
      }
    }
    errors
  }
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #538574 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports

Loading