Implement Conan API v2 Get endpoint, add feature flag v1 ping capability
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA
This merge request adds a feature-flag to enable revisions capabilities and an initial endpoint definition for conan v2. This is part of the ongoing effort to enable Conan revisions support, as detailed in this issue.
Changes
- Feature Flag Implementation:
- Added new feature flag
conan_package_revisions_supportto control new functionality - When enabled, this flag enables new V2 endpoints.
- Added new feature flag
- V2 API Implementation:
- Added new
API::Conan::V2::ProjectPackagesclass to handle V2 endpoints in the future
- Added new
Feature Flag Details
- Name:
conan_package_revisions_support - Default state: Disabled
- Controls: Addition of 'revisions' capability in V1 ping response and availability of V2 endpoints
How to set up and validate locally
Since the backend is not implemented for the endpoint there is no need to setup a project and package for testing, the important part is to use the correct path and valid parameters.
-
Enable feature flag in rails console (docs).
For GDK, open rails console:
gdk rails consoleTo enable the flag run:
Feature.enable(:conan_package_revisions_support)To check that it is set:
Feature.enabled?(:conan_package_revisions_support)To disable the flag run:
Feature.disable(:conan_package_revisions_support) -
Calling the ping v1 endpoint
curl --request GET --url http://127.0.0.1:3000/api/v4/projects/9/packages/conan/v1/pingThe respose will have status
200 OKand headerX-Conan-Server-Capabilities: revisions. When the flag is off the header will not be there. -
Calling the v2 file endpoint
curl --request GET --url 'http://127.0.0.1:3000/api/v4/projects/9/packages/conan/v2/conans/searchTest/1.3.4/gitlab-org+conan/stable/revisions/1f04d9667e60236fe5b0a05c506bb4a6/files/conanfile.py'When the flag is on the expected response is:
- status:
404 Not Found - body:
{"message": "Not supported"}
When the flag is off the expected response is:
- status:
404 Not Found - body:
{"message": "'conan_package_revisions_support' feature flag is disabled"}
- status:
-
Calling the v2 file endpoint with invalid parameters
curl --request GET --url 'http://127.0.0.1:3000/api/v4/projects/9/packages/conan/v2/conans/searchTest/1.3.4/gitlab-org+conan/stable/revisions/1f04d9667e60236fe5b0a05c506bb4a6/files/conanfile.txt'When the flag is on the expected response is:
- status:
400 Bad Request - body:
{"error": "file_name does not have a valid value"}
When the flag is off the expected response is:
- status:
404 Not Found - body:
{"message": "'conan_package_revisions_support' feature flag is disabled"}
- status:
Next Steps
- Authentication-related changes for V2 endpoints will be addressed in a future merge request.
- Further V2 endpoints and functionality will be implemented in subsequent merge requests.
References
- Feature flag issue: #483083 (closed)
- Initial investigation on conan v2: #333033 (comment 2060136937)