Skip to content

[Feature flag] Remove compliance_violations_graphql_type

What does this MR do and why?

This MR removes the compliance_violations_graphql_type feature flag from the codebase and makes sure the authorizations are all set up properly.

The feature flag was added in %14.8 and the work was completed in %14.9.

GraphQL query

Query
query getComplianceViolations($fullPath: ID!, $filters: ComplianceViolationInput, $sort: ComplianceViolationSort) {
  group(fullPath: $fullPath) {
    id
    mergeRequestViolations(filters: filters, sort: sort) {
      nodes {
        id
        severityLevel
        reason
        violatingUser {
          id
          name
          username
          state
          avatarUrl
          webUrl
        }
        mergeRequest {
          id
          title
          mergedAt
          milestone {
            id
            title
          }
          webUrl
          author {
            id
            name
            username
            state
            avatarUrl
            webUrl
          }
          mergeUser {
            id
            name
            username
            state
            avatarUrl
            webUrl
          }
          committers {
            nodes {
              id
              name
              username
              state
              avatarUrl
              webUrl
            }
          }
          participants {
            nodes {
              id
              name
              username
              state
              avatarUrl
              webUrl
            }
          }
          approvedBy {
            nodes {
              id
              name
              username
              state
              avatarUrl
              webUrl
            }
          }
          ref: reference
          fullRef: reference(full: true)
          sourceBranch
          sourceBranchExists
          targetBranch
          targetBranchExists
          headPipeline {
            detailedStatus {
              id
              icon
              favicon
              text
              label
              group
              tooltip
              hasDetails
              detailsPath
            }
          }
          project {
            id
            avatarUrl
            name
            webUrl
            complianceFrameworks {
              nodes {
                id
                name
                description
                color
              }
            }
          }
        }
      }
    }
  }
}

How to set up and validate locally

Setting up the violations

  1. Go to a projects general settings and make sure Prevent approval by author. is unticked under the Merge request approvals section
  2. Edit a file in the project and create a new merge request
  3. Use the merge requests author to approve the merge request and then merge it
  4. Wait for merging to be completed

Running the query

  1. Open your preferred GraphQL caller. You could use [GDK_HOST]/-/graphql-explorer
  2. Check that the violations you created above are shown using the query
  3. Test the different filters and sorting options to check that they work as expected

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #350249 (closed)

Edited by Robert Hunt

Merge request reports

Loading