Add get package files with revision
-
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 adds the conan V2 endpoint to get the package files from a package that is also used by V1 with revisions.
Changelog: added
References
How to set up and validate locally
-
Switch the
conan_package_revisions_supportfeature flag on.For GDK, open rails console (docs):
gdk rails consoleEnable 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"|base64Then 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 there are two package files uploaded.
Create two package files:
echo "info" > "conaninfo.txt" echo "1744016993" > "conanmanifest.txt"Upload the two files:
curl --request PUT \ --upload-file conaninfo.txt \ --url 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/conans/packagefiles/1.0.0/user/stable/revisions/123456789012345678901234567890ab/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files/conaninfo.txt' \ --header 'Authorization: Bearer <YOUR-CONAN-JWT-TOKEN>' curl --request PUT \ --upload-file conanmanifest.txt \ --url 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/conans/packagefiles/1.0.0/user/stable/revisions/123456789012345678901234567890ab/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files/conanmanifest.txt' \ --header 'Authorization: Bearer <YOUR-CONAN-JWT-TOKEN>' -
Call the get package files endpoint
curl --request GET \ --url 'http://localhost:3000/api/v4/projects/<project_id>/packages/conan/v2/conans/packagefiles/1.0.0/user/stable/revisions/123456789012345678901234567890ab/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files' \ --header 'Authorization: Bearer <YOUR-CONAN-JWT-TOKEN>'that should return status
200 OKand body:{ "files": { "conaninfo.txt": {}, "conanmanifest.txt": {} } }
/cc @oceane_scania
Related to #519741 (closed)
Edited by 🤖 GitLab Bot 🤖