Geo Support Resync/Reverify for registries via GraphQL
requested to merge 364725-geo-replicables-support-resync-and-reverify-actions-for-individual-replicable-via-graphql into master
What does this MR do and why?
This MR adds a new mutation: GeoRegistriesUpdateMutation
that allows resyncing and reverifying registries individually via GraphQL API.
How to set up and validate locally
Use the following examples to validate the mutation locally. Prepare a personal token to use for bearer token auth.
Reverify one registry
Example: Mutation of a SnippetRepositoryRegistry
with ID 20.
Using curl:
curl --location 'http://<LOCALHOST_URL>/api/v4/geo/node_proxy/2/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <AUTH-TOKEN>' \
--data '{"query":" mutation {\n geoRegistriesUpdate(\n input: {\n action: REVERIFY\n registryId: \"gid://gitlab/Geo::SnippetRepositoryRegistry/20\",\n registryClass: SNIPPET_REPOSITORY_REGISTRY\n }\n ) {\n registry {\n ... on SnippetRepositoryRegistry {\n id\n state\n retryCount\n lastSyncFailure\n retryAt\n lastSyncedAt\n verifiedAt\n verificationRetryAt\n createdAt\n snippetRepositoryId \n }\n }\n errors\n }\n }","variables":{}}'
Using the Rails console:
mutation = %(
mutation {
geoRegistriesUpdate(
input: {
action: REVERIFY
registryId: "gid://gitlab/Geo::SnippetRepositoryRegistry/20",
registryClass: SNIPPET_REPOSITORY_REGISTRY
}
) {
registry {
... on SnippetRepositoryRegistry {
id
state
retryCount
lastSyncFailure
retryAt
lastSyncedAt
verifiedAt
verificationRetryAt
createdAt
snippetRepositoryId
}
}
errors
}
}
)
current_user = User.find_by_username('root') # by default is admin
result = GitlabSchema.execute(mutation, context: { current_user: current_user })
Resync one registry
Example: Mutation of a LfsObjectRegistry
with ID 9.
Using curl:
curl --location 'http://<LOCALHOST_URL>/api/v4/geo/node_proxy/2/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <AUTH-TOKEN>' \
--data '{"query":"mutation {\n geoRegistriesUpdate(\n input: {\n action: RESYNC\n registryId: \"gid://gitlab/Geo::LfsObjectRegistry/9\",\n registryClass: LFS_OBJECT_REGISTRY\n }\n ) {\n registry {\n ... on LfsObjectRegistry {\n id\n state\n retryCount\n lastSyncFailure\n retryAt\n lastSyncedAt\n verifiedAt\n verificationRetryAt\n createdAt\n lfsObjectId \n }\n }\n errors\n }\n}\n","variables":{}}'
Using the Rails console:
mutation = %(
mutation {
geoRegistriesUpdate(
input: {
action: RESYNC
registryId: "gid://gitlab/Geo::LfsObjectRegistry/9",
registryClass: LFS_OBJECT_REGISTRY
}
) {
registry {
... on LfsObjectRegistry {
id
state
retryCount
lastSyncFailure
retryAt
lastSyncedAt
verifiedAt
verificationRetryAt
createdAt
lfsObjectId
}
}
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 #364725 (closed)
Edited by Javiera Tapia