Skip to content

Relax version validation on generic packages

👕 Context

Generic packages versions are validated with this simple regex: /\A\d+\.\d+\.\d+\z/.

Users asked to be able to add labels similar to what is accepted in SemVer. Example: 1.0.0-rc. In addition, we received needs for simpler versions such as 1.2g and commit SHAs such as d50d836eb3de6177ce6c7a5482f27f9c2c84b672

See issues #273034 (closed), #325293 (closed) and #255234 (closed)

The package team decided to ease the validation of versions for generic packages.

🔬 What does this MR do?

  • Update the package version validator for generic packages to use the maven_version
  • Update the related specs
  • Update the related documentation

🖼 Screenshots (strongly suggested)

Before this MR

$ curl --header "PRIVATE-TOKEN: XXXX" --upload-file ./dummy.txt "http://gdk.test:8000/api/v4/projects/71/packages/generic/my_package/1.2.2-rc/file.txt"
{"error":"package_version is invalid"}

With this MR

$ curl --header "PRIVATE-TOKEN: XXXX" --upload-file ./dummy.txt "http://gdk.test:8000/api/v4/projects/71/packages/generic/my_package/1.2.2-rc/file.txt"
{"message":"201 Created"}

🎉

📐 Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by David Fernandez

Merge request reports