Repository navigation
[EngSys] Add opt-in Rust native wheel build support #49397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jenny (JennyPng)
merged 9 commits into
Azure:main
from
JennyPng:engsys/rust-native-build-support
Oct 12, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
345b8b9
[EngSys] Add opt-in Rust native wheel build support
JennyPng 567b558
[EngSys] Fix spelling exceptions for native build documentation
JennyPng b4accfc
[EngSys] Clarify native build pipeline requirements
JennyPng 3240bd1
Minor doc update
JennyPng 5034d12
keep fallback
JennyPng aaf2e33
add azure-template-three
JennyPng e6fb68a
black
JennyPng 8e1984e
Revert azure-template-three fixture onboarding
JennyPng 328c7d9
only install toolchain when needed, handle is compiled independently
JennyPng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
eng/pipelines/templates/steps/install-msrust-toolchain.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| parameters: | ||
| # Use an organization-local mirror; the job token cannot authenticate directly to DevDiv. | ||
| # See https://aka.ms/rustinado. | ||
| - name: ToolchainFeed | ||
| type: string | ||
| default: '' | ||
| # Directory containing rust-toolchain.toml, which selects the compiler version. | ||
| - name: WorkingDirectory | ||
| type: string | ||
| default: '' | ||
| - name: AdditionalTargets | ||
| type: string | ||
| default: '' | ||
| # Mirror crates.io for network-isolated builds; ~force-auth makes Cargo authenticate upstream requests. | ||
| - name: CratesIoFeed | ||
| type: string | ||
| default: 'sparse+https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-rust-public~force-auth/Cargo/index/' | ||
| - name: Condition | ||
| type: string | ||
| default: succeeded() | ||
|
|
||
| steps: | ||
| - pwsh: | | ||
| $ErrorActionPreference = 'Stop' | ||
| if (-not $env:RUST_TOOLCHAIN_FEED) { | ||
| throw 'An organization-local Rust toolchain feed must be configured.' | ||
| } | ||
| if (-not $env:RUST_WORKING_DIRECTORY) { | ||
| throw 'The directory containing rust-toolchain.toml must be configured.' | ||
| } | ||
| if (-not (Test-Path (Join-Path $env:RUST_WORKING_DIRECTORY 'rust-toolchain.toml') -PathType Leaf)) { | ||
| throw "No rust-toolchain.toml found in $env:RUST_WORKING_DIRECTORY" | ||
| } | ||
| displayName: 'Validate Rust build configuration' | ||
| condition: ${{ parameters.Condition }} | ||
| env: | ||
| RUST_TOOLCHAIN_FEED: ${{ parameters.ToolchainFeed }} | ||
| RUST_WORKING_DIRECTORY: ${{ parameters.WorkingDirectory }} | ||
|
|
||
| # Installs the host toolchain; Linux build containers bootstrap their own. | ||
| - task: RustInstaller@1 | ||
| displayName: 'Install internal Rust toolchain' | ||
| condition: ${{ parameters.Condition }} | ||
| inputs: | ||
| toolchainFeed: ${{ parameters.ToolchainFeed }} | ||
| workingDirectory: ${{ parameters.WorkingDirectory }} | ||
| ${{ if ne(parameters.AdditionalTargets, '') }}: | ||
| additionalTargets: ${{ parameters.AdditionalTargets }} | ||
|
|
||
| # Configure Cargo after RustInstaller defines CARGO_HOME. | ||
| - pwsh: | | ||
| $ErrorActionPreference = 'Stop' | ||
| Write-Host "##vso[task.setvariable variable=MSRUSTUP_FEED_URL]$env:RUST_TOOLCHAIN_FEED" | ||
| $cargoHome = $env:CARGO_HOME | ||
| if (-not $cargoHome) { | ||
| $cargoHome = [System.IO.Path]::Combine($HOME, '.cargo') | ||
| } | ||
| New-Item -ItemType Directory -Force -Path $cargoHome | Out-Null | ||
| $configPath = Join-Path $cargoHome 'config.toml' | ||
| if (Test-Path $configPath) { | ||
| throw "Refusing to overwrite an existing Cargo configuration: $configPath" | ||
| } | ||
|
|
||
| # Keep the registry name aligned with the forwarded CARGO_REGISTRIES_* variables. | ||
| # Use the Git CLI so dependency fetches honor the agent's Git configuration. | ||
| @" | ||
| [registries] | ||
| azure-sdk-for-rust-public = { index = "$env:CARGO_FEED_URL" } | ||
|
|
||
| [source.crates-io] | ||
| replace-with = "azure-sdk-for-rust-public" | ||
|
|
||
| [net] | ||
| git-fetch-with-cli = true | ||
| "@ | Set-Content -Path $configPath -Encoding utf8 | ||
|
|
||
| Write-Host "##vso[task.setvariable variable=CargoConfigPath]$configPath" | ||
| # Linux containers cannot see this config; the registry environment variable does not replace sources. | ||
| # Package hooks must write their own Cargo source replacement. | ||
| Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_AZURE_SDK_FOR_RUST_PUBLIC_INDEX]$env:CARGO_FEED_URL" | ||
| displayName: 'Configure Rust build feeds' | ||
| condition: ${{ parameters.Condition }} | ||
| env: | ||
| RUST_TOOLCHAIN_FEED: ${{ parameters.ToolchainFeed }} | ||
| CARGO_FEED_URL: ${{ parameters.CratesIoFeed }} | ||
|
|
||
| - task: NuGetAuthenticate@1 | ||
| displayName: 'Acquire an Azure Artifacts token' | ||
| condition: ${{ parameters.Condition }} | ||
|
|
||
| # CargoAuthenticate reads SYSTEM_ACCESSTOKEN; use the token acquired by NuGetAuthenticate. | ||
| - task: CargoAuthenticate@0 | ||
| displayName: 'Authenticate cargo to the Azure Artifacts feed' | ||
| condition: ${{ parameters.Condition }} | ||
| inputs: | ||
| configFile: $(CargoConfigPath) | ||
| env: | ||
| SYSTEM_ACCESSTOKEN: $(VSS_NUGET_ACCESSTOKEN) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.