Use internal crate feed in Azure Pipelines#4279
Conversation
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.
There was a problem hiding this comment.
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 -ZscriptRust helper scripts ineng/scripts/. - Add
eng/scripts/use-registry.rsto toggle.cargo/config.tomlbetween crates.io and the internal registry. - Introduce a manually-triggered
eng/pipelines/fetch.ymlpipeline and afetchjob template to install the credential provider andcargo fetchvia 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. |
|
With the upcoming changes, I ran the following tests:
|
|
@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. |
9fba96b to
90ce370
Compare
|
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 |
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