Add latest recipe revision endpoint
-
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. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
This MR add the V2 endpoint to get latest recipe revision. This endpoint is also used by v1 with revision. This endpoint is required to install packages.
Request: GET /api/v4/projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/latest
Response: { "revision" : "75151329520e7685dcf5da49ded2fec0", "time" : "2024-12-17T09:16:40.334+0000" }
References
- #519741 (closed): Conan V2 follow up issue
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
No UI changes
How to set up and validate locally
-
Switch the
conan_package_revisions_support
feature flag on.For GDK, open rails console (docs):
gdk rails console
Enable the feature flag:
# Enable Feature.enable(:conan_package_revisions_support) # Verify Feature.enabled?(:conan_package_revisions_support)
-
Get Conan Authentication Token
First, generate a base64-encoded Basic Auth token:
# Replace with your username and PAT echo -n "USERNAME:glpat-YOUR-TOKEN"|base64
Then use the output to get a Conan JWT token:
curl --request GET \ --url 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v1/users/authenticate' \ --header 'Authorization: Basic <YOUR-BASE64-TOKEN>'
-
Make sure to upload the same file in the same package with two different revisions
You will have to check out the
333033-put-endpoint-revision-recipe-file
branch to be able to upload recipe files as a prerequisite for manual testing. Follow the instructions here to manually upload the same recipe file with different revisions (conanfile.py
). Upload once the file with revision123456789012345678901234567890ab
and after with11111111111111111111111111111111
. -
Call the get recipe files endpoint
Make sure you are back on this branch
519741-latest-recipe-files
and run:curl --request GET \ 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/conans/upload-v2-package/1.0.0/user/stable/latest' \ --header 'Authorization: Bearer <YOUR-CONAN-JWT-TOKEN>'
that should return status
200 OK
and body with latest revision:{ "revision" : "11111111111111111111111111111111", "time" : "<Time of upload in iso-8601 format: 2025-03-04T12:46:18.844Z" }
/cc @mbo5be
Related to #519741 (closed)