Skip to content

Use internal crate feed in Azure Pipelines#4279

Draft
heaths wants to merge 4 commits intoAzure:mainfrom
heaths:issue2397
Draft

Use internal crate feed in Azure Pipelines#4279
heaths wants to merge 4 commits intoAzure:mainfrom
heaths:issue2397

Conversation

@heaths
Copy link
Copy Markdown
Member

@heaths heaths commented Apr 25, 2026

Allows contributors to pull from crates.io without having to authenticate with the internal feed, but the registry can easily be switched. Azure Pipelines will use this internal feed to pull crates.

Resolves #2397

heaths added 2 commits April 24, 2026 17:37
External contributors can still pull from crates.io, while internal builds use the internal feed.
We'll do this by replacing crates.io with our internal feed internally.

Resolves Azure#2397
If we call `cargo --config='...' fetch` instead the registry cache won't be right - at least locally - which may cause problems if other commands run later.
Also updates other scripts' dependencies to be unified and fixes a problem in update-cratenames.rs by using the newer cargo-util-schemas@0.13.0.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for switching Cargo to an internal Azure Artifacts registry and introduces a dedicated pipeline to pre-fetch/mirror dependencies into that feed.

Changes:

  • Bump dependency versions used by several cargo -Zscript Rust helper scripts in eng/scripts/.
  • Add eng/scripts/use-registry.rs to toggle .cargo/config.toml between crates.io and the internal registry.
  • Introduce a manually-triggered eng/pipelines/fetch.yml pipeline and a fetch job template to install the credential provider and cargo fetch via the internal registry.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
eng/scripts/verify-keywords.rs Updates inline script dependencies (serde/serde_json).
eng/scripts/verify-dependencies.rs Updates inline script dependencies (serde/serde_json/toml).
eng/scripts/use-registry.rs New cargo-script to toggle [source.crates-io].replace-with for internal registry usage.
eng/scripts/update-pathversions.rs Updates inline script dependencies (regex/toml_edit) and applies formatting-only edits.
eng/scripts/update-cratenames.rs Updates inline script dependencies (cargo-util-schemas/toml).
eng/pipelines/templates/jobs/fetch.yml New job template to configure auth + registry and run cargo fetch.
eng/pipelines/fetch.yml New manually-triggered pipeline wiring the fetch job into the platform matrix.
.cargo/config.toml Adds internal registry definition and (commented) crates-io replacement setting.

Comment thread eng/pipelines/templates/jobs/fetch.yml Outdated
Comment thread eng/pipelines/templates/jobs/fetch.yml Outdated
Comment thread eng/scripts/use-registry.rs Outdated
Comment thread eng/scripts/use-registry.rs Outdated
@heaths heaths changed the title issue2397 Use internal crate feed in Azure Pipelines Apr 27, 2026
@heaths heaths requested a review from benbp April 27, 2026 18:47
@heaths
Copy link
Copy Markdown
Member Author

heaths commented Apr 27, 2026

With the upcoming changes, I ran the following tests:

# Config before Mode Expected Pass?
1 No ~/.cargo/config.toml azure File created with [registries.azure-sdk-for-rust] and [source.crates-io] replace-with
2 Has azure-sdk-for-rust registry + comments, no replace-with azure Comment preserved, no duplicate registry, replace-with added
3 Has a different registry + comments, no azure-sdk-for-rust azure Both registries kept, comment preserved, replace-with added
4 Has two registries + comments + replace-with crates.io replace-with removed; both registries, comments, and [source.crates-io] preserved
5 Has a registry, no [source] section crates.io No crash, file unchanged

@heaths
Copy link
Copy Markdown
Member Author

heaths commented Apr 27, 2026

@benbp can you at least review the matrix code? I compared with several other pipelines but I'm not entirely sure it's correct. Basically, I want to make sure we fetch crates in the same matrix config as CI because some crates or their transitive dependencies can be platform- or even toolchain-specific.

@heaths heaths force-pushed the issue2397 branch 3 times, most recently from 9fba96b to 90ce370 Compare April 27, 2026 21:47
@heaths heaths marked this pull request as draft April 28, 2026 17:43
@heaths
Copy link
Copy Markdown
Member Author

heaths commented Apr 28, 2026

Marking this as a draft while I talk to some other teams. The guidelines appear to be for binaries, which we don't ship. We have OSS-friendly (stored in GitHub, run by Azure Pipelines and GitHub Actions) workflows that already have all our platform build-out logic in place. In order to install msrustup we have to use a separate RustInstaller task in our pipeline, which means either putting public/internal conditions in our existing pipelines or having a completely separate pipeline, thereby duplicating all our platform build-out logic. And for what? We ship source, not binaries. 3P customers still have to pull from crates.io, while 1P customers will use their own artifact feeds which should upstream crates.io. We have Component Governance scans as well as run cargo audit and cargo deny in both PR and CI builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable builds using internal package feeds

2 participants