To enable calculation of Cargo metadata, in the Administration module, go to Repositories | Repositories | Local and select Cargo as the Package Type when you create your local repository.
Prior to setting a local repository, you will need to configure a Custom Base URL for the Artifactory instance. For more information, see General Settings. |
You will need to maintain a specific path structure to manage the Cargo packages that are uploaded to Cargo local repositories.
Cargo Source packages are automatically uploaded by default to the relative path: crates/{package_name}/{package_name}-{version}.crate
.
Artifactory supports yanking and un-yanking crates in local repositories.
cargo yank hello_world --vers 0.1.4 --token "Bearer (token)" cargo yank hello_world --vers 0.1.4 --token "Bearer (token)" --undo |
To synchronize yanking in Smart remote repositories/replications, the properties must be synced. |
Prior to setting a remote repository, you will need to configure a Custom Base URL for the Artifactory instance that is required to support. For more information, see General Settings. |
You can create remote Cargo repositories to proxy and cache remote repositories or other Artifactory instances.
The Registry URL has been added to Cargo remote repositories, to reflect the index (git) location:
https://github.com/rust-lang/crates.io-index
http(s)://art_url/artifactory/git/repo_name.git
. For example: http://127.0.0.1/artifactory/git/cargo-local.git
.To resolve Cargo packages:
In the Artifact Tree Browser, select a Cargo repository and click Set Me Up.
Install a package using the Cargo build or install commands.
cargo install crate |
To resolve multiple registries, add this optional flag |
The Cargo client does not send any authentication header when running install and search commands. |
You can deploy packages to a local Cargo repository using the Cargo Client, using the Deploy feature in the UI, or using a cURL request.
To deploy a package, run the following Cargo publish
command.
cargo publish or cargo publish --registry (registry id) |
To override the credentials for that repository, run the following command.
cargo publish --token "Basic (base64 of user:password)"or cargo publish --token "Bearer (access token)" |
You can either drag and drop, or select a Cargo package to upload in Deploy in the UI. Artifactory will automatically identify if the package is a source or binary package.
It is important to be aligned with the following layout to support this feature.
|
To deploy a package using a cURL request.
curl -uadmin:password -XPUT "http://localhost:8082/artifactory/cargo-local/crates/package_1.0.0.crate" -T package_1.0.0.crate |
When deploying directly (PUT request to a specific path), make sure the target path is a valid Cargo path.
crates/{package_name}/{package_name}-{version}.crate |
Note that deploying a package to a different path will not identify the package as Cargo packages, and will not invoke metadata indexing.
Artifactory lets you view selected metadata of a Cargo package directly from the UI.
In the Artifact Repository Browser, select your local Cargo repository and scroll down to find and select the package you want to inspect.
The metadata is displayed in the Cargo Info tab, or view in the Packages view.
You can trigger an asynchronous re-indexing of a local Cargo repository either through the UI or using the REST API.
This will also reindex the git index and, as a result, will also index the remote repositories.
In the Artifact Tree Browser, select your Cargo repository, right-click and select Recalculate Index from the list. Requires Admin privileges.
To reindex a Cargo repository through the REST API, refer to Calculate Cargo Repository Metadata.