Skip to content

Use Conan recipe as package name in API response

Steve Abrams requested to merge 239130-conan-recipe-display-be into master

What does this MR do?

Conan packages are a bit different from the other package types dealt with in the GitLab package registry (NPM, Maven, etc). A Conan package has a name, but in working with Conan, developers deal with the recipe rather than just the name. This MR updates the package API response to return the recipe in the name field so that the conan recipe will be used in place of the name throughout the UI. It also adds an additional attribute conan_package_recipe so users and the frontend can still access the conan package name as a singular value.

Screenshots

Before:

$ curl -H "Private-Token: <token>" http://localhost:3001/api/v4/projects/17/packages
[
  {
    "id": 25,
    "name": "Hello",
    "version": "0.1",
    "package_type": "conan",
    "_links": {
      "web_path": "/root/npm_n2/-/packages/25",
      "delete_api_path": "http://127.0.0.1:3001/api/v4/projects/17/packages/25"
    },
    "created_at": "2020-09-16T20:33:34.316Z",
    "tags": []
  }
]

After:

$ curl -H "Private-Token: <token>" http://localhost:3001/api/v4/projects/17/packages
[
  {
    "id": 25,
    "name": "Hello/0.1@root+my-conan-proj/stable",
    "conan_package_name": "Hello",
    "version": "0.1",
    "package_type": "conan",
    "_links": {
      "web_path": "/root/npm_n2/-/packages/25",
      "delete_api_path": "http://127.0.0.1:3001/api/v4/projects/17/packages/25"
    },
    "created_at": "2020-09-16T20:33:34.316Z",
    "tags": []
  }
]

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

Related #239130 (closed)

Edited by Steve Abrams

Merge request reports