Uredi

Deli z drugimi prek


Get started with Cargo packages in Azure Artifacts

Azure DevOps Services | Azure DevOps Server 2022

Using Azure Artifacts, you can publish and download Cargo packages to feeds and public registries. This article guides you through setting up your project and publishing your Cargo packages to your Azure Artifacts feed.

Prerequisites

  • An Azure DevOps organization and a project. Create an organization or a project if you haven't already.

  • Download and install rustup.

Create a feed

If you already have an existing Azure Artifacts feed that can be used for Cargo you can jump to the next section.

Note

Azure Artifacts recommends using a distinct feed for consuming crates from crates.io, and a separate feed exclusively for publishing internal crates.

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select Create Feed.

  3. Give your feed a Name and specify its Visibility. Check the Upstream sources checkbox if you want to include packages from public registries and then select a Scope for your feed.

  4. Select Create when you're done.

Connect to a feed

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to feed, and then select Cargo from the tool selection pane.

  4. Follow the Project setup instructions on the Connect to feed page.

Important

Cargo support in Azure Artifacts requires rust version 1.74 or newer which includes support for the 'registry-auth' feature. To update your rust version, run rustup update

Important

Cargo is currently in preview and may require the nightly toolchain with the registry-auth unstable-feature enabled. To enable registry-auth, add the following to .cargo/config.toml.

[unstable]
registry-auth = true

To use the nightly toolchain, run the following command:

rustup default nightly

Publish packages

To publish your Cargo package, run the following command in your project directory:

cargo publish