Conan Repositories

JFrog Artifactory Documentation

ft:sourceType
Paligo

Overview

Artifactory introduces advanced artifact management to the world of C/C++ through support for local repositories that work directly with the Conan client to manage Conan packages and dependencies. As a repository to which builds can be uploaded, and from which dependencies can be downloaded, Artifactory offers many benefits to C/C++ developers using Conan:

  1. Secure, private repositories for C/C++ packages with fine-grained access control according to projects or development teams

  2. Automatic layout and storage of C/C++ packages for all platforms configured in the Conan client

  3. The ability to provision C/C++ dependencies from Artifactory to the Conan command line tool from local repositories.

  4. Enterprise features such as high availability, repository replication for multi-site development, different options for massively scalable storage.

For more details on building Conan packages and working with the Conan client, please refer to the Conan documentation.

Artifactory Community Edition for C/C++

Conan repositories are available in Artifactory CE.

> Learn more

Note

From Xray 3.21.2 and above, Xray can scan Conan packages, for more information see Conan and C/C++ Support in Xray.

Configuration

Local Repositories

To enable calculation of C/C++ package metadata, from the Administration module, select Repositories | Repositories | Localand set Conan to be the Package Type when you create your local repository.

conan-local_new.jpg

Make sure to also select conan-default as the repository layout.

Integration Benefits

JFrog Artifactory and Conan Repositories

Remote Repositories

Deprecation Notice

JFrog Bintray is being sunset. Please refer this blog post for more detail.

A Remote Repository defined in Artifactory serves as a caching proxy for a registry managed at a remote URL such as https://center.conan.io, or even a Conan repository managed at a remote site by another instance of Artifactory.

Conan packages requested from a remote repository are cached on demand. You can remove Conan packages from the remote repository cache, however, you can not manually push Conan files to a remote Conan repository.

To define a remote repository to proxy a remote repository follow the steps below:

  1. In the Administration module, under Repositories | Repositories | Remote, click New Remote Repository.

  2. In the New Repository dialog, set the Package Type to Conan, set the Repository Key value, and specify the URL to the remote repository in the URL field as displayed below.

Remote Conan Repository.jpg

Resolving Conan Remote Packages

To resolve Conan remote packages, aggregate the remote repository in a virtual repository as they cannot be resolved directly from the remote repositories.

Virtual Repositories

A Virtual Repositories defined in Artifactory aggregates Conan packages from both local and remote repositories that are included in the virtual repositories. Using virtual repositories can be very useful since users will continue to work with the virtual repository while the admin can manage the included repositories, replace the default deployment target and those changes will be transparent to the users.

To define a virtual Conan repository follow these steps:

  1. Create a new Virtual Repository, in the Administration module, under Repositories | Repositories | Virtual, click New Virtual Repository and set Conan as the Package Type.

  2. Set the Repository Key value.

  3. Select the underlying local and remote Conan repositories to include under the Repositories section.

  4. You can optionally also configure your Default Deployment Repository

Virtual Conan Repository.jpg

Using Conan with Artifactory

Once the Conan client is installed, you can access Conan repositories in Artifactory through its command line interface. You can only install packages from or export packages to your Artifactory local Conan repository using the Conan client.

Local vs. Remote

Don't let Conan terminology confuse you. For the purposes of this integration, the Conan "Remote" is actually the Artifactory local repository you have created for Conan packages.

Once you have created your Conan repository, select it in the Tree Browser view in the Application module, Artifactory | Artifacts tab, and click Set Me Up to see the code snippets you will need in order to use your repository as a source to install packages and as a target for export.

Conan Set Me Up.jpg

In the sections below, <REMOTE> is used to denote the logical name you set with which the Conan client can identify the Conan local repository in Artifactory.

Adding Your Repository

To use your local repository with Conan, you first need to add it as a Conan "Remote" to the client as follows:

conan remote add <REMOTE> http://<ARTIFACTORY_URL>/api/conan/<REPO_KEY>

Where:

<REPO_KEY> is the repository key.

Conan repositories must be prefixed with api/conan in the path

When accessing a Conan repository through Artifactory, the repository URL must be prefixed with api/conan in the path. This applies to all Conan commands including conan install.

For example, if you are using Artifactory standalone or as a local service, you would access your Conan repositories using the following URL:

http://localhost:8081/artifactory/api/conan/<repository key>

Or, if you are using Artifactory Cloud, the URL would be:

https://<server name>.jfrog.io/artifactory/api/conan/<repository key>

Authenticating the Conan Client

To authenticate the Conan client to Artifactory you need to log in using:

conan user -p <PASSWORD> -r <REMOTE> <USERNAME>

Accessing Artifactory anonymously

If Artifactory is configured for anonymous access, you may skip authenticating the Conan client.Introduction to the General Security Settings

Allowing Anonymous Access

Artifactory supports Conan repositories with Allow Anonymous Access enabled.

When Allow Anonymous Access is enabled, Artifactory will not query the Conan client for authentication parameters by default, so you need to indicate to Artifactory to request authentication parameters in a different way.

You can override the default behavior by setting the Force Authentication checkbox in the New or Edit Repository dialog.

image2022-1-25_4-37-36.png

When set, Artifactory will first request authentication parameters from the Conan client before trying to access this repository.

Installing Dependencies

To install dependencies from Artifactory as defined in your conanfile.txt file use:

conan install . -r <REMOTE>
Uploading Packages

To upload packages to your Artifactory local Conan repository use:

 conan upload <RECIPE> -r <REMOTE> --all

Where <RECIPE> specifies your Conan recipe reference formatted <NAME>/<VERSION>@<USER>/<CHANNEL>

Viewing Individual Conan Package Information

Artifactory lets you view selected metadata of a Conan package directly from the UI.

In the Application module, Artifactory | Artifacts tab, Tree Browser, and drill down to select the package file you want to inspect. The metadata is displayed in the Conan Info tab. The specific information displayed depends on the tree item you have selected. Selecting the root item of a package displays details of the Conan recipe used to upload the package.

Conan Info.jpg

If you select one of the packages, you get detailed Conan Package info including Settings, Options and dependencies ("Requires")