Draft: Create a new GitLab version based on linked issues
What does this MR do and why?
Describe in detail what your merge request does and why.
Content
- Add option for
VersionClient
to create a patch version - Add
patch
option for thecreate_version
method to optionally add the parametersecurity_release_type
to the request body. - Add corresponding rspec.
Ref: gitlab-com/gl-infra/delivery#20228 (closed)
Testing
The tests below show the following:
- The new change does not break the current usage
-
patch
is optional - An existing version is not recreated or updated using
create_version
-
- A new version can be created when
patch: true
is provided.
[2] pry(main)> ReleaseTools::VersionClient.create_version('16.1.2')
{"id":12,"version":"16.1.2","major":16,"minor":1,"vulnerable":false,"details":null,"created_at":"2024-07-10T15:52:48.900Z"}
=> #<Gitlab::ObjectifiedHash:238280 {hash: {"id"=>12, "version"=>"16.1.2", "major"=>16, "minor"=>1, "vulnerable"=>false, "details"=>nil, "created_at"=>"2024-07-10T15:52:48.900Z"}}
[3] pry(main)> ReleaseTools::VersionClient.create_version('16.1.2',patch: true)
{"message":{"version":["has already been taken"]}}
=> #<Gitlab::ObjectifiedHash:238300 {hash: {"message"=>{"version"=>["has already been taken"]}}}
[4] pry(main)> ReleaseTools::VersionClient.create_version('16.1.3',patch: true)
{"id":13,"version":"16.1.3","major":16,"minor":1,"vulnerable":false,"details":null,"created_at":"2024-07-10T15:53:22.846Z"}
=> #<Gitlab::ObjectifiedHash:238320 {hash: {"id"=>13, "version"=>"16.1.3", "major"=>16, "minor"=>1, "vulnerable"=>false, "details"=>nil, "created_at"=>"2024-07-10T15:53:22.846Z"}}
Edited by Dat Tang