Add option for VersionClient to create a patch version
What does this MR do and why?
Describe in detail what your merge request does and why.
- 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
In order to test, I need to use the staging version endpoint.
class VersionClient < Gitlab::Request
base_uri 'https://gitlab-org-gitlab-services-version-gitlab-com-staging.version-staging.gitlab.org/'
The tests below show the following:
- The new change does not break the current usage
-
version_type
is optional - An existing version is not recreated or updated using
create_version
-
[1] pry(main)> ReleaseTools::VersionClient.create_version('16.1.2')
=> #<Gitlab::ObjectifiedHash:238260 {hash: {"message"=>{"version"=>["has already been taken"]}}}
[3] pry(main)> ReleaseTools::VersionClient.create_version('16.1.2',version_type: :patch_regular)
=> #<Gitlab::ObjectifiedHash:238280 {hash: {"message"=>{"version"=>["has already been taken"]}}}
- When creating a new version:
[4] pry(main)> ReleaseTools::VersionClient.create_version('16.1.6',version_type: :patch_regular)
=> #<Gitlab::ObjectifiedHash:238300 {hash: {"id"=>16, "version"=>"16.1.6", "major"=>16, "minor"=>1, "vulnerable"=>false, "details"=>nil, "created_at"=>"2024-07-16T15:15:37.759Z"}}
The new version is marked as having no security issue, while the older patch versions are marked with "Non Critical"
Edited by Dat Tang