Skip to content

Draft: Create a new GitLab version based on linked issues

Dat Tang requested to merge dattang/create-patch-version into master

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 the create_version method to optionally add the parameter security_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"}}
  • Note that, there is no difference in the response between a normal version and a patch version. The difference is in the previous version - it is now marked as having a vulnerability.

    Screenshot 2024-07-10 at 19.18.22.png

Edited by Dat Tang

Merge request reports

Loading