Add get package files with revision

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

  1. 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)
  2. 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>'
  3. 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>'
  4. 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 OK and body:

    { "files": { "conaninfo.txt": {}, "conanmanifest.txt": {} } }

/cc @oceane_scania

Related to #519741 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading