Skip to content

Handle updated "Cloud Connector Access" GQL query

Aleksei Lipniagov requested to merge 436622-accept-new-cc-gql into master

What does this MR do and why?

This CDot MR - https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/8987 - renames and expands the GQL query (serviceToken->cloudConnectorAccess).
This should be reflected on the GitLab-Rails side.

In essence:

  • Updates and renames the GraphQL query we receive from CDot
  • Saves the available_services access data information into the DB
  • Renames some service classes, methods, and test cases to reflect that we receive more information in the GQL query than just a token
  • Fixes a bug in the existing code we discussed in !140980 (comment 1720061858)

Note: The code change sits behind :use_sync_service_token_worker feature flag, which was not enabled yet.

Follow-ups (separate MRs)

  1. move existing services (and maybe worker too?) from Ai to CloudConnector namespace/folder.
  2. introduce CloudConnector::Access API to access the data from the JSON in a friendly way: !141379 (closed) (WIP!)

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.

How to set up and validate locally

  • Firstly, you need to run CustomersDot locally, connect it to your GitLab instance, and have a valid Cloud license issued to your GitLab instance.
  • Pull this branch: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/8987
  • Make sure FF is enabled for your local CDot instance: cloud_connector_available_services. It doesn't work for me locally as described in CDot Readme (need to investigate), so unless I figure it out, I just mocked it: if true || Unleash.enabled?(:cloud_connector_available_services)
  • On your local GitLab, pull this branch
  • Open rails console: export GITLAB_LICENSE_MODE=test && export CUSTOMER_PORTAL_URL='http://localhost:5000' && bundle exec rails c (adjust CDot URL accordingly)
  • Run the sync: result = ::Ai::SyncCloudConnectorAccessService.new.execute
  • Check that the data was saved to the DB: ::CloudConnector::Access.last should have the data, ::CloudConnector::Access.count should be 1

Related to #436622

Edited by Aleksei Lipniagov

Merge request reports