Skip to content

Return the error when prerequisites for integrations are not met

What does this MR do and why?

This MR improves the visibility and changes the GrapQL query to contain the error when required prerequisites for the integrations are not met. That means when the Google Artifact Management integration or the Google Cloud IAM integration isn't active or does not exist, the GraphQL will return the error.

I left the feature flag and the SaaS feature check as it is now since it felt not right to move the feature flag and the SaaS feature checks to the GoogleCloud::ArtifactRegistry::RepositoryType

Additionally, I didn't want to introduce a new resolver since the feature flag will be removed soon Remove `google_cloud_support_feature_flag` feat... (!150472) and to have a resolver only for the SaaS feature check sounds like an overkill.

What I did is I've changed the description of the google_cloud_artifact_registry_repository field to contain the note that the field may be also nil when the GitLab instance is not a SaaS instance.

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

Condition Before After
Google Artifact Management integration isn't active Screenshot_2024-05-02_at_15.03.01 Screenshot_2024-05-02_at_14.46.48
Google Artifact Management integration doesn't exist Screenshot_2024-05-02_at_15.03.01 Screenshot_2024-05-02_at_14.46.48
Google Cloud IAM integration isn't active Screenshot_2024-05-02_at_15.03.01 Screenshot_2024-05-02_at_14.50.32
Google Cloud IAM integration doesn't exist Screenshot_2024-05-02_at_15.03.01 Screenshot_2024-05-02_at_14.51.03

How to set up and validate locally

  1. Required setup for Google Cloud is described here

  2. Prepare the project with the Google Artifact Management and Google Cloud IAM integrations.

  3. Visit http://gdk.test:3000/-/graphql-explorer and create the request.

    query getGarArtifactsFromProject {
      project(fullPath: "<project full path>") {
        googleCloudArtifactRegistryRepository {
          projectId,
          repository,
          artifactRegistryRepositoryUrl,
          artifacts {
            nodes {
              ... on GoogleCloudArtifactRegistryDockerImage {
                name
              }
            }
          }
        }
      }
    }

    The request should return all requested data.

  4. Now we could do one of the following things to validate the changes.

    • Update the Google Artifact Management integration to be inactive.
    • Update the Google Cloud IAM integration to be inactive.
    • Delete the Google Artifact Management integration. (I've updated the project_id field of the integration)
    • Delete the Google Cloud IAM integration. (I've updated the project_id field of the integration)

    In every case the GraphQL request should contain the error message.

Related to #443518 (closed)

Edited by Dzmitry Meshcharakou

Merge request reports