GraphQL mutation to allow maven virtual registry upstream to be updated
What does this MR do and why?
GraphQL mutation to allow maven virtual registry upstream to be updated
This can be used like:
mutation {
mavenUpstreamUpdate (input: {
id: "gid://gitlab/VirtualRegistries::Packages::Maven::Upstream/1",
cacheValidityHours: 16
}) {
upstream {
id
name
description
cacheValidityHours
}
}
}
References
Changes are inspired from container virtual registry upstream update mutation.
Screenshots or screen recordings
NA
Database
SQL Query:
↳ ee/app/services/virtual_registries/packages/maven/update_upstream_service.rb:32:in `execute'
VirtualRegistries::Packages::Maven::Upstream Update (221.0ms) UPDATE "virtual_registries_packages_maven_upstreams" SET "updated_at" = '2026-02-09 07:54:01.756229', "cache_validity_hours" = 16 WHERE "virtual_registries_packages_maven_upstreams"."id" = 1
How to set up and validate locally
Steps to validate locally will be:
-
Switch to this branch
`gitlab-community/gitlab-org/gitlab:harsh/mavenUpstreamUpdateMutation` -
Enable feature flag and setup Virtual registry settings in rails console
# Enable container virtual registry ::Feature.enable(:maven_virtual_registry) # Create virtual registry setting group = Group.find_by(path: 'gitlab-org') user = User.find(1) VirtualRegistries::Settings::CreateOrUpdateService.new( group: group, current_user: user, params: { enabled: true } ).execute -
Create virtual registries container upstreams
group = Group.find 24 registry = FactoryBot.create(:virtual_registries_packages_maven_registry, group: group) upstream = FactoryBot.create(:virtual_registries_packages_maven_upstream, registries: [registry], name: "upstream1") gid = upstream.to_gid.to_s -
Go to Graphql explorer (http://localhost:3000/-/graphql-explorer) and test the new mutation type
mutation { mavenUpstreamUpdate (input: { id: "gid://gitlab/VirtualRegistries::Packages::Maven::Upstream/1", cacheValidityHours: 16 }) { upstream { id name description cacheValidityHours } } } # Response: { "data": { "mavenUpstreamUpdate": { "upstream": { "id": "gid://gitlab/VirtualRegistries::Packages::Maven::Upstream/1", "name": "upstream1", "description": "description", "cacheValidityHours": 16 } } }, "correlationId": "01KH0MDEVC3F5EHVDQJJ1DX5D9" } # Verifying update with get query query { virtualRegistriesPackagesMavenUpstream(id: "gid://gitlab/VirtualRegistries::Packages::Maven::Upstream/1") { id name description cacheValidityHours } } # Response: { "data": { "virtualRegistriesPackagesMavenUpstream": { "id": "gid://gitlab/VirtualRegistries::Packages::Maven::Upstream/1", "name": "upstream1", "description": "description", "cacheValidityHours": 16 } }, "correlationId": "01KH0N0W2HCPXYDHSNRXWBYFKG" }
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to: #577440 (closed)
Edited by Harsh Rai