-
Notifications
You must be signed in to change notification settings - Fork 285
Add API View to build #2396
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
Merged
Add API View to build #2396
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
570cd60
Add API View to build
hallipr 91be328
Use toolchain defaulting instead explit toolchain in each cargo call
hallipr ce98ce7
Add Use-Rust.ps1
hallipr 1d4f099
Run rustup self update
hallipr 8c95b2c
Only update rustup if version < 1.28
hallipr 4138d25
Powershell cleanup
hallipr d8bdbe2
Only update rustup if we're using 'default' toolchain
hallipr a55dc3e
Stop Get-rust-AdditionalValidationPackagesFromPackageSet returning $null
hallipr 625d722
Add API Review step to release template
hallipr c6fff3d
Update eng/pipelines/templates/stages/archetype-rust-release.yml
hallipr 8e1e091
Add execute perm to Use-rust.ps1
hallipr 19e2c86
Use-rust must be inlined powershell for use in the 1es deployment job
hallipr 0f8c7dc
Use regex in place of eng/common semver type
hallipr b086e70
Add exit on bad exit code
hallipr b8e2c56
Remove command prefix >
hallipr e44a370
Change naming to Submit API Review
hallipr ba3b7fd
Add comments, check rustup version from non-repo folder, use correct …
hallipr a94b65c
Reorder args in rustup install command
hallipr 5e7bd2b
Remove write-host for rustup default
hallipr cdeb3ef
Add download step to apireview job
hallipr 77b25c3
Combine API Review and package version update
hallipr 39fb6c7
Bump template project versions to cause api view change detection
hallipr 3319873
Use .rust.json files
hallipr c6235a3
Update eng/scripts/Language-Settings.ps1
hallipr a313f6d
Only bump template to 0.2.0
hallipr 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,100 @@ | ||
parameters: | ||
- name: Toolchain | ||
type: string | ||
default: stable | ||
default: active | ||
# Expexted values: 'stable', 'nightly', 'msrv', 'active' or a specific toolchain version | ||
# 'msrv' will read the MSRV from azure_core | ||
# 'active' will use the active toolchain for the working directory, which will be from rust-toolchain.toml, from a | ||
# folder override or the rustup default toolchain | ||
- name: MaxAttempts | ||
type: number | ||
default: 3 | ||
- name: WorkingDirectory | ||
type: string | ||
default: $(System.DefaultWorkingDirectory) | ||
- name: SetDefault | ||
type: boolean | ||
default: true | ||
|
||
steps: | ||
- pwsh: | | ||
$toolchain = '${{ parameters.Toolchain }}' | ||
if ($toolchain -eq 'msrv') { | ||
Write-Host "Reading MSRV from azure_core" | ||
$toolchain = cargo read-manifest --manifest-path ./sdk/core/azure_core/Cargo.toml | ConvertFrom-Json | Select-Object -ExpandProperty rust_version | ||
} | ||
- pwsh: | | ||
$Toolchain = '${{ parameters.Toolchain }}' | ||
$MaxAttempts = ${{ parameters.MaxAttempts }} | ||
$SetDefault = $${{ parameters.SetDefault }} | ||
|
||
function Invoke-LoggedCommand($command) { | ||
Write-Host "##[group]$command" | ||
Invoke-Expression $command | ||
Write-Host "##[endgroup]" | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Command failed: $command" | ||
exit $LASTEXITCODE | ||
} | ||
} | ||
|
||
if ($Toolchain -eq 'msrv') { | ||
Write-Host "Reading MSRV from azure_core" | ||
$toolchainArg = cargo read-manifest --manifest-path "$(System.DefaultWorkingDirectory)/sdk/core/azure_core/Cargo.toml" | ||
| ConvertFrom-Json | ||
| Select-Object -ExpandProperty rust_version | ||
} | ||
elseif ($Toolchain -eq 'active') { | ||
# You can't call 'rustup install' without a toolchain before rustup 1.28.0. If know we'll be doing that, make sure | ||
# we have the latest rustup installed | ||
|
||
# Depending on the version of rustup currently installed, simply calling `rustup --version` will install the | ||
# active toolchain per rust-toolchain.toml if it's not already installed. We should check the rust version | ||
# outside of our repo's context to avoid any rustup-toolchain file influence. | ||
|
||
Push-Location '$(Pipeline.Workspace)' | ||
Invoke-LoggedCommand "rustup --version" | Tee-Object -Variable rustupVersion | ||
|
||
if ($rustupVersion -match 'rustup (\d+).(\d+).\d+') { | ||
$major = $matches[1] | ||
$minor = $matches[2] | ||
if ($major -lt 1 -or $minor -lt 28) { | ||
Invoke-LoggedCommand "rustup self update" | ||
} | ||
} | ||
Pop-Location | ||
|
||
Write-Host "Setting Toolchain variable to $toolchain" | ||
Write-Host "##vso[task.setvariable variable=Toolchain]$toolchain" | ||
$toolchainArg = '' | ||
} | ||
else { | ||
$toolchainArg = $toolchain | ||
} | ||
|
||
$attempts = 0 | ||
$maxAttempts = ${{ parameters.MaxAttempts }} | ||
$attempts = 0 | ||
|
||
while ($true) { | ||
while ($true) { | ||
$attempts++ | ||
Write-Host "> rustup toolchain install --no-self-update $toolchain" | ||
rustup toolchain install --no-self-update $toolchain | ||
|
||
if ($?) { exit 0 } | ||
Invoke-LoggedCommand "rustup install --no-self-update $toolchainArg" | ||
|
||
if ($attempts -lt $maxAttempts) { | ||
Write-Host "Failed to install $toolchain, attempt $attempts, retrying..." | ||
} else { | ||
Write-Host "Failed to install $toolchain after $attempts attempts." | ||
exit 1 | ||
if ($?) { break } | ||
|
||
if ($attempts -lt $MaxAttempts) { | ||
Write-Host "Install failed, attempt $attempts, retrying..." | ||
} | ||
else { | ||
Write-Host "Install failed after $attempts attempts." | ||
exit 1 | ||
} | ||
|
||
# Failures to update are usually caused by file locks in Windows. | ||
# Sleep for a few seconds to give the blocking process a chance to release the lock. | ||
Start-Sleep -Seconds 3 | ||
} | ||
} | ||
|
||
if ($SetDefault) { | ||
if ($Toolchain -eq 'active') { | ||
$toolchainArg = rustup show active-toolchain -v | Select-Object -First 1 | ||
} | ||
|
||
Invoke-LoggedCommand "rustup default $toolchainArg" | ||
} | ||
|
||
Invoke-LoggedCommand "rustup show" | ||
|
||
displayName: "Use Rust ${{ parameters.Toolchain }}" | ||
displayName: "Use Rust ${{ parameters.Toolchain }}" | ||
workingDirectory: ${{ parameters.WorkingDirectory }} |
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
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.