Add instance endpoints for conan v2
-
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?
Add instance endpoints for conan v2
Add Conan V2 API endpoints at instance level for user authentication, credential checking, package searching, upload, download...
Changelog: added
References
- #519741 (closed) General v2 support issue
- #549070 Instance endpoint support issue
- #549072 Feature flag roll out issue
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
1. Check and Install Conan 2.x
Install conan v2
To test this MR you need to have conan v2
Verify installation:
conan --version
Should show version 2.x.x
If you have conan v1, you need to uninstall it and install v2:
pip uninstall conan
pip install conan
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_instance_level)
# Verify
Feature.enabled?(:conan_package_revisions_support_instance_level)
2. Configure Conan Client
conan remote add gitlab-local-instance http://localhost:3000/api/v4/packages/conan
conan remote login gitlab-local-instance
# Enter username and password (glpat)
3. Create and Upload a Package
Replace by the '+' separated project path, see https://docs.gitlab.com/user/packages/conan_repository/#package-recipe-naming-convention-for-instance-remotes
3.1 Create a Test Package
# Create a new directory for your package
mkdir instancev2pkg && cd instancev2pkg
# Create a basic Conan package
conan new cmake_lib -d name=instancev2 -d version=1.2.3
# Build the package
conan create . --name instancev2 --version 1.2.3 --user <project-path> --channel stable
3.2 Upload Package to GitLab
# Upload the package to GitLab
conan upload instancev2/1.2.3@<project-path>/stable -r gitlab-local-instance
# Verify upload success
conan list instancev2/1.2.3@<project-path>/stable -r gitlab-local-instance
4 Remove your package locally
conan remove instancev2/1.2.3
5 Search for the packahe
# Search with user/channel
conan search instancev2/1.2.3@<project-path>/stable -r gitlab-local-instance
# Search with *
conan search instancev2/*@<project-path>/stable -r gitlab-local-instance
6. Download the package
conan download instancev2/1.2.3@<project-path>/stable -r gitlab-local-instance
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #519741 (closed)
Edited by Océane Legrand