-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Promote NuGet.Client
builds during official CI
#48311
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
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# NuGet.Client does not flow to the VMR directly but only to dotnet/sdk where it is validated | ||
# Upon the version bump happens in dotnet/sdk, this job promotes that build of NuGet.Client to | ||
# another channel from where it flows into the VMR. | ||
# The sdk and nuget.client subscriptions are batched and go into the VMR in a single PR. | ||
# More information: https://github.com/dotnet/arcade-services/issues/4618 | ||
|
||
parameters: | ||
- name: assetName | ||
type: string | ||
displayName: Name of the asset to promote | ||
|
||
jobs: | ||
premun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- job: PromoteNuGetClient | ||
displayName: Promote NuGet Client | ||
pool: | ||
name: NetCore1ESPool-Publishing-Internal | ||
image: windows.vs2019.amd64 | ||
os: windows | ||
|
||
steps: | ||
- template: ../steps/install-darc.yml@self | ||
|
||
- template: ../steps/get-asset-info.yml@self | ||
parameters: | ||
assetName: ${{ parameters.assetName }} | ||
|
||
- task: AzureCLI@2 | ||
displayName: 🟣 Assign build to channel | ||
inputs: | ||
azureSubscription: "Darc: Maestro Production" | ||
scriptType: ps | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
$version = '$(AssetVersion)' | ||
|
||
Write-Host "Promoting build of asset ${{ parameters.assetName }} / $version..." | ||
|
||
$assets = .\.dotnet\dotnet darc get-asset --name '${{ parameters.assetName }}' --version "$version" --max-age 60 --output-format json --ci | ||
$parsedAssets = $assets | ConvertFrom-Json | ||
|
||
if (-not $parsedAssets -or -not $parsedAssets[0]) { | ||
Write-Error "No build found to promote version $version" | ||
exit 1 | ||
} | ||
|
||
$buildId = $parsedAssets[0].build.id | ||
try { | ||
$defaultChannels = .\.dotnet\dotnet darc get-default-channels --source-repo https://github.com/dotnet/sdk --branch "$(Build.SourceBranchName)" --output-format json --ci | ConvertFrom-Json | ||
} catch { | ||
Write-Host "No default channels found for branch $(Build.SourceBranchName) - no promotion will take place" | ||
exit 0 | ||
} | ||
|
||
premun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ($defaultChannels.Count -eq 0) { | ||
Write-Host "Default channels list is empty for branch $(Build.SourceBranchName) - no promotion will take place" | ||
exit 0 | ||
} | ||
$targetChannel = $defaultChannels[0].channel.name | ||
premun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Write-Host "Promoting build $buildId to channel $targetChannel" | ||
|
||
.\.dotnet\dotnet darc add-build-to-channel --id $buildId --channel "$targetChannel" --skip-assets-publishing --ci |
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,42 @@ | ||
### Looks up asset information from Version.Details.xml and stores it in variables | ||
|
||
parameters: | ||
- name: assetName | ||
type: string | ||
displayName: Name of the asset to look up | ||
|
||
steps: | ||
- task: AzureCLI@2 | ||
displayName: 🟣 Get version information | ||
inputs: | ||
azureSubscription: "Darc: Maestro Production" | ||
scriptType: ps | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
$ErrorActionPreference = 'Stop' | ||
Write-Host "Searching for details of asset ${{ parameters.assetName }}..." | ||
|
||
$dependencies = .\.dotnet\dotnet darc get-dependencies --name '${{ parameters.assetName }}' --ci | ||
$version = $dependencies | Select-String -Pattern 'Version:\s+([^\s]+)' | Select-Object -First 1 | ||
|
||
if ($version -eq $null) { | ||
Write-Error "Asset ${{ parameters.assetName }} not found in the dependency list" | ||
exit 1 | ||
} | ||
|
||
$version -match 'Version:\s+([^\s]+)' | Out-Null | ||
$version = $matches[1] | ||
|
||
$repository = $dependencies | Select-String -Pattern 'Repo:\s+([^\s]+)' | Select-Object -First 1 | ||
$repository -match 'Repo:\s+([^\s]+)' | Out-Null | ||
$repository = $matches[1] | ||
|
||
$commit = $dependencies | Select-String -Pattern 'Commit:\s+([^\s]+)' | Select-Object -First 1 | ||
$commit -match 'Commit:\s+([^\s]+)' | Out-Null | ||
$commit = $matches[1] | ||
|
||
Write-Host "##vso[task.setvariable variable=AssetRepository]$repository" | ||
Write-Host "##vso[task.setvariable variable=AssetCommit]$commit" | ||
Write-Host "##vso[task.setvariable variable=AssetVersion]$version" | ||
|
||
Write-Host "Asset ${{ parameters.assetName }} found with version $version, commit $commit, repository $repository" |
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,18 @@ | ||
steps: | ||
- powershell: | | ||
$ErrorActionPreference = 'Stop' | ||
. .\eng\common\tools.ps1 | ||
$dotnetRoot = InitializeDotNetCli -install:$true | ||
$dotnet = "$dotnetRoot\dotnet.exe" | ||
& "$dotnet" tool restore | ||
displayName: 🟣 Install darc (Windows) | ||
condition: eq(variables['Agent.OS'], 'Windows_NT') | ||
|
||
- script: | | ||
set -e | ||
. .\eng\common\tools.sh | ||
dotnetRoot=$(InitializeDotNetCli --install) | ||
dotnet="$dotnetRoot/dotnet" | ||
$dotnet tool restore | ||
displayName: 🟣 Install darc (Unix) | ||
condition: ne(variables['Agent.OS'], 'Windows_NT') |
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.