Allow CD Version name to be free-form
What does this MR do and why?
This MR lets a CD Version be created with a free-form name, instead of only ever being auto-created from a container registry push.
A Cd::Version records one version of an artifact tied to a Cd::ArtifactSource. Until now, GitLab could only create a version automatically, when it saw a container image get pushed to a registry it watches, and the version name had to match strict registry-tag naming rules. That meant there was no way to record a version for an artifact hosted somewhere GitLab never receives a push event from, and no way to give a version a name that doesn't look like a registry tag. This MR adds a verified flag on Cd::Version: versions created the old way (from a real push event) stay verified: true and still have their name format checked, but a version can now also be created with verified: false, which skips the name format check and accepts any free text. A new service and GraphQL mutation, cdVersionCreate, let a caller record a version this way, and every version created through this mutation comes out verified: false, since it's telling GitLab about something it didn't observe itself.
The cdVersionCreate mutation is gated behind the ai_native_deploy feature flag, like the rest of CD, and is marked GraphQL Experiment.
How to test
1. Seed data (Rails console)
organization = Organizations::Organization.first
application = Cd::Application.find_or_create_by!(organization: organization, name: 'test-app')
service = Cd::Service.find_or_create_by!(application: application, name: 'test-service')
artifact_source = Cd::ArtifactSource.find_or_create_by!(service: service, name: 'test-artifact-source') do |as|
as.source_ref = 'external/registry/test'
end
Feature.enable(:ai_native_deploy)
puts artifact_source.to_global_id2. Call the mutation (GraphQL Explorer at /-/graphql-explorer)
mutation($artifactSourceId: CdArtifactSourceID!, $name: String!) {
cdVersionCreate(input: { artifactSourceId: $artifactSourceId, name: $name }) {
version {
id
name
verified
}
errors
}
}Variables (use the ID printed in step 1):
{
"artifactSourceId": "gid://gitlab/Cd::ArtifactSource/1",
"name": "my release / build 1+rc"
}Expected: the mutation succeeds, returns the new version with verified: false and the free-text name unchanged, and errors is empty.
References
https://gitlab.com/gitlab-org/gitlab/-/work_items/616346
https://gitlab.com/gitlab-org/gitlab/-/work_items/617187
Screenshots or screen recordings
No UI change — backend and GraphQL only.
How to set up and validate locally
- Seed an organization, application, service, and artifact source, and enable the
ai_native_deployfeature flag. - Call the
cdVersionCreatemutation with a free-textname(spaces, slashes, or other characters not allowed by the old registry-tag format check). - Confirm in the response, or in the database, that the version was created with
verified: falseand no validation errors.
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.