Skip to content

ci: seed public cargo feed from Cargo.lock on lockfile changes#557

Draft
MGudgin wants to merge 1 commit into
mainfrom
user/gudge/seed-public-cargo-feed
Draft

ci: seed public cargo feed from Cargo.lock on lockfile changes#557
MGudgin wants to merge 1 commit into
mainfrom
user/gudge/seed-public-cargo-feed

Conversation

@MGudgin

@MGudgin MGudgin commented Jun 24, 2026

Copy link
Copy Markdown
Member

Fork PRs lose System.AccessToken and only run the GitHub Actions gates, which build against real crates.io. They never exercise the network-isolated ADO build that redirects crates.io to the anonymous-read MxcDependencies feed, so a fork-PR lockfile bump can introduce a brand-new transitive crate that was never cached in the public feed. The next in-repo PR or main push then fails cargo fetch with a 401 (as seen for futures-task/slab after #534).

Add Seed.Cargo.Feed.yml + scripts/ci/seed-cargo-feed.ps1 to authenticated- download every locked crate's .crate file into the feed (which persists each version) whenever Cargo.lock changes, plus a daily safety-net run.

📖 Description

🔗 References

🔍 Validation

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the official build pipeline that signs the binaries; it
runs on merge to main and nightly, and Microsoft reviewers can trigger it
on a PR with /azp run. See docs/pull-requests.md.

Microsoft Reviewers: Open in CodeFlow

Fork PRs lose System.AccessToken and only run the GitHub Actions gates,
which build against real crates.io. They never exercise the network-isolated
ADO build that redirects crates.io to the anonymous-read MxcDependencies feed,
so a fork-PR lockfile bump can introduce a brand-new transitive crate that was
never cached in the public feed. The next in-repo PR or main push then fails
cargo fetch with a 401 (as seen for futures-task/slab after #534).

Add Seed.Cargo.Feed.yml + scripts/ci/seed-cargo-feed.ps1 to authenticated-
download every locked crate's .crate file into the feed (which persists each
version) whenever Cargo.lock changes, plus a daily safety-net run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 24, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an Azure DevOps pipeline + helper script to proactively “seed” the public anonymous-read MxcDependencies Cargo feed by authenticated-downloading every crates.io package pinned in src/Cargo.lock, preventing future cargo fetch 401s in the network-isolated ADO lane after lockfile bumps.

Changes:

  • Add scripts/ci/seed-cargo-feed.ps1 to parse src/Cargo.lock and download each locked crates.io .crate using an authenticated Azure Artifacts URL template from the sparse index config.json.
  • Add .azure-pipelines/Seed.Cargo.Feed.yml to run seeding on main when relevant files change and on a daily schedule, using a secret PAT from a variable group.
  • Document the public feed behavior and the new seeding pipeline in .azure-pipelines/README.md.
Show a summary per file
File Description
scripts/ci/seed-cargo-feed.ps1 New PowerShell seeding script that discovers the feed download template and downloads all locked crates with authentication.
.azure-pipelines/Seed.Cargo.Feed.yml New scheduled/lockfile-triggered ADO pipeline to run the seeding script with a secret PAT.
.azure-pipelines/README.md Adds documentation explaining why seeding is needed and how the new pipeline/script works.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 4

Comment on lines +84 to +85
$IndexUrl = $IndexUrl.TrimEnd('/')
Write-Host "Public feed index: $IndexUrl"
Comment on lines +91 to +96
$config = Invoke-RestMethod -Uri "$IndexUrl/config.json" -Headers @{ Authorization = $auth }
$dlTemplate = $config.dl
if ([string]::IsNullOrWhiteSpace($dlTemplate)) {
Write-Host "##[error]Feed config.json did not return a 'dl' download template."
exit 1
}
Comment on lines +42 to +44
[`Seed.Cargo.Feed.yml`](Seed.Cargo.Feed.yml) closes that gap. It runs on `main`
whenever `src/Cargo.lock` changes (and on a daily schedule), and authenticated-
downloads every locked crate's `.crate` file via
Comment on lines +19 to +20
not enough). This script walks src/Cargo.lock and authenticated-downloads
every crates.io `.crate` file, which permanently saves each version so the
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.

2 participants