Geo: Support Resync All and Reverify All actions via GraphQL
requested to merge 364728-geo-replicables-support-resync-all-and-reverify-all-actions-for-entire-replicable-type-via into master
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
- Geo primary and secondary sites must be enabled locally: https://gitlab.com/gitlab-org/gitlab-development-kit/blob/main/doc/howto/geo.md
- Geo proxying must be enabled: https://docs.gitlab.com/ee/administration/geo/secondary_proxy/
- Prepare a personal access token to use as a
Bearer Token Auth
to authorize the request.
Test cases
SnippetRepositoryRegistry
registries
1. Reverify all - 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:
- 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":{}}'
- 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 })
SnippetRepositoryRegistry
registries
2. Resync all - 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:
- 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":{}}'
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #364728 (closed)
Edited by Javiera Tapia