Update ML Model Versions to use semver module
What does this MR do and why?
With Adding SemanticVersionable concern to Ml::Model... (!142228 - merged) merged, this MR updates the Ml::ModelVersion
to write new records to include the semver
attributes. It writes the original version
column, and uses the semver
setter to parse and save the semver attributes to semver_major
, semver_minor
, semver_patch
, and semver_prerelease
. Once this MR is deployed, another MR will be created to add additional DB constraints and indexes for querying on the semver attributes.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
In a local rails console run:
-
Create a model
model = Ml::CreateModelService.new(Project.first, 'test-model').execute
-
Create a model version
version = Ml::ModelVersion.create(model: model, project: model.project, version: '1.2.3')
-
Ensure the semver attributes (major, minor, patch) are set on the model version record
version => #<Ml::ModelVersion:0x000000028e3b7460 id: 3, created_at: Wed, 14 Feb 2024 16:28:06.081816000 UTC +00:00, updated_at: Wed, 14 Feb 2024 16:28:06.081816000 UTC +00:00, project_id: 1, model_id: 2, package_id: nil, version: "1.2.3", description: nil, semver_major: 1, semver_minor: 2, semver_patch: 3, semver_prerelease: nil>