Skip to content

Geo: Support Resync All and Reverify All actions via GraphQL

What does this MR do and why?

This MR creates a new mutation GeoRegistriesBulkUpdateMutation to perform two new actions: RESYNC_ALL and REVERIFY_ALL to update Geo registries in batches via GraphQL API.

How to set up and validate locally

Instructions

Test cases

1. Reverify all SnippetRepositoryRegistry registries

  1. In the terminal, run gdk tail rails-background-jobs | grep 'Geo::BulkMarkVerificationPendingBatchWorker'. The mutation should enqueue a worker, and that is what we want to test.

In a separate window:

  1. Using curl:
curl --location 'http://<GDK_URL>/api/v4/geo/node_proxy/2/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <ACCESS-TOKEN>' \
--data '{"query":"  mutation {\n    geoRegistriesBulkUpdate(\n      input: {\n        action: REVERIFY_ALL\n        registryClass: SNIPPET_REPOSITORY_REGISTRY\n      }\n    ) {\n      registryClass\n      errors\n    }\n  }","variables":{}}'
  1. Using the Rails console (optional):
mutation = %(
  mutation {
    geoRegistriesBulkUpdate(
      input: {
        action: REVERIFY_ALL
        registryClass: SNIPPET_REPOSITORY_REGISTRY
      }
    ) {
      registryClass
      errors
    }
  }
)

current_user = User.find_by_username('root') # by default is admin
result = GitlabSchema.execute(mutation, context: { current_user: current_user })

2. Resync all SnippetRepositoryRegistry registries

  1. In the terminal, run gdk tail rails-background-jobs | grep 'Geo::BulkMarkPendingBatchWorker'. The mutation should enqueue a worker, and that is what we want to test.

In a separate window:

  1. Using curl:
curl --location 'http://<GDK_URL>/api/v4/geo/node_proxy/2/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <AUTH_TOKEN>' \
--data '{"query":"  mutation {\n    geoRegistriesBulkUpdate(\n      input: {\n        action: RESYNC_ALL\n        registryClass: SNIPPET_REPOSITORY_REGISTRY\n      }\n    ) {\n      registryClass\n      errors\n    }\n  }","variables":{}}'
  1. Using the Rails console (optional):
mutation = %(
  mutation {
    geoRegistriesBulkUpdate(
      input: {
        action: RESYNC_ALL
        registryClass: SNIPPET_REPOSITORY_REGISTRY
      }
    ) {
      registryClass
      errors
    }
  }
)

current_user = User.find_by_username('root') # by default is admin
result = GitlabSchema.execute(mutation, context: { current_user: current_user })

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 #364728 (closed)

Edited by Javiera Tapia

Merge request reports