Skip to content

Commit efcd108

Browse files
dotnet-maestro[bot]baronfel
authored andcommitted
Update dependencies from https://github.com/dotnet/arcade build 20190726.18 (#7285)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19376.18
1 parent 16aea55 commit efcd108

20 files changed

+246
-141
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19375.15">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19376.18">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>ef1c110152df0d500fffb87878a86f88d1ca5295</Sha>
8+
<Sha>316481e57ee5e6acbbf2401eb6778a1d3d48d25b</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

eng/common/post-build/darc-gather-drop.ps1

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
param(
2-
[Parameter(Mandatory=$true)][string] $BarBuildId, # ID of the build which assets should be downloaded
3-
[Parameter(Mandatory=$true)][string] $MaestroAccessToken, # Token used to access Maestro API
4-
[Parameter(Mandatory=$true)][string] $DropLocation # Where the assets should be downloaded to
2+
[Parameter(Mandatory=$true)][int] $BarBuildId, # ID of the build which assets should be downloaded
3+
[Parameter(Mandatory=$true)][string] $DropLocation, # Where the assets should be downloaded to
4+
[Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, # Token used to access Maestro API
5+
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com", # Maestro API URL
6+
[Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16" # Version of Maestro API to use
57
)
68

7-
$ErrorActionPreference = "Stop"
8-
Set-StrictMode -Version 2.0
9-
10-
. $PSScriptRoot\..\tools.ps1
9+
. $PSScriptRoot\post-build-utils.ps1
1110

1211
try {
1312
Write-Host "Installing DARC ..."
@@ -24,8 +23,8 @@ try {
2423
--continue-on-error `
2524
--id $BarBuildId `
2625
--output-dir $DropLocation `
27-
--bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ `
28-
--password $MaestroAccessToken `
26+
--bar-uri $MaestroApiEndpoint `
27+
--password $MaestroApiAccessToken `
2928
--latest-location
3029
}
3130
catch {

eng/common/post-build/nuget-validation.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ param(
66
[Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to
77
)
88

9-
$ErrorActionPreference = "Stop"
10-
Set-StrictMode -Version 2.0
11-
12-
. $PSScriptRoot\..\tools.ps1
9+
. $PSScriptRoot\post-build-utils.ps1
1310

1411
try {
1512
$url = "https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Most of the functions in this file require the variables `MaestroApiEndPoint`,
2+
# `MaestroApiVersion` and `MaestroApiAccessToken` to be globally available.
3+
4+
$ErrorActionPreference = "Stop"
5+
Set-StrictMode -Version 2.0
6+
7+
# `tools.ps1` checks $ci to perform some actions. Since the post-build
8+
# scripts don't necessarily execute in the same agent that run the
9+
# build.ps1/sh script this variable isn't automatically set.
10+
$ci = $true
11+
. $PSScriptRoot\..\tools.ps1
12+
13+
function Create-MaestroApiRequestHeaders([string]$ContentType = "application/json") {
14+
Validate-MaestroVars
15+
16+
$headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
17+
$headers.Add('Accept', $ContentType)
18+
$headers.Add('Authorization',"Bearer $MaestroApiAccessToken")
19+
return $headers
20+
}
21+
22+
function Get-MaestroChannel([int]$ChannelId) {
23+
Validate-MaestroVars
24+
25+
$apiHeaders = Create-MaestroApiRequestHeaders
26+
$apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}?api-version=$MaestroApiVersion"
27+
28+
$result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
29+
return $result
30+
}
31+
32+
function Get-MaestroBuild([int]$BuildId) {
33+
Validate-MaestroVars
34+
35+
$apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken
36+
$apiEndpoint = "$MaestroApiEndPoint/api/builds/${BuildId}?api-version=$MaestroApiVersion"
37+
38+
$result = try { return Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
39+
return $result
40+
}
41+
42+
function Get-MaestroSubscriptions([string]$SourceRepository, [int]$ChannelId) {
43+
Validate-MaestroVars
44+
45+
$SourceRepository = [System.Web.HttpUtility]::UrlEncode($SourceRepository)
46+
$apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken
47+
$apiEndpoint = "$MaestroApiEndPoint/api/subscriptions?sourceRepository=$SourceRepository&channelId=$ChannelId&api-version=$MaestroApiVersion"
48+
49+
$result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
50+
return $result
51+
}
52+
53+
function Trigger-Subscription([string]$SubscriptionId) {
54+
Validate-MaestroVars
55+
56+
$apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken
57+
$apiEndpoint = "$MaestroApiEndPoint/api/subscriptions/$SubscriptionId/trigger?api-version=$MaestroApiVersion"
58+
Invoke-WebRequest -Uri $apiEndpoint -Headers $apiHeaders -Method Post | Out-Null
59+
}
60+
61+
function Assign-BuildToChannel([int]$BuildId, [int]$ChannelId) {
62+
Validate-MaestroVars
63+
64+
$apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken
65+
$apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$MaestroApiVersion"
66+
Invoke-WebRequest -Method Post -Uri $apiEndpoint -Headers $apiHeaders | Out-Null
67+
}
68+
69+
function Validate-MaestroVars {
70+
try {
71+
Get-Variable MaestroApiEndPoint -Scope Global | Out-Null
72+
Get-Variable MaestroApiVersion -Scope Global | Out-Null
73+
Get-Variable MaestroApiAccessToken -Scope Global | Out-Null
74+
75+
if (!($MaestroApiEndPoint -Match "^http[s]?://maestro-(int|prod).westus2.cloudapp.azure.com$")) {
76+
Write-PipelineTaskError "MaestroApiEndPoint is not a valid Maestro URL. '$MaestroApiEndPoint'"
77+
ExitWithExitCode 1
78+
}
79+
80+
if (!($MaestroApiVersion -Match "^[0-9]{4}-[0-9]{2}-[0-9]{2}$")) {
81+
Write-PipelineTaskError "MaestroApiVersion does not match a version string in the format yyyy-MM-DD. '$MaestroApiVersion'"
82+
ExitWithExitCode 1
83+
}
84+
}
85+
catch {
86+
Write-PipelineTaskError "Error: Variables `MaestroApiEndPoint`, `MaestroApiVersion` and `MaestroApiAccessToken` are required while using this script."
87+
Write-Host $_
88+
ExitWithExitCode 1
89+
}
90+
}

eng/common/post-build/promote-build.ps1

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
param(
22
[Parameter(Mandatory=$true)][int] $BuildId,
33
[Parameter(Mandatory=$true)][int] $ChannelId,
4-
[Parameter(Mandatory=$true)][string] $BarToken,
5-
[string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com",
6-
[string] $ApiVersion = "2019-01-16"
4+
[Parameter(Mandatory=$true)][string] $MaestroApiAccessToken,
5+
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com",
6+
[Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16"
77
)
88

9-
$ErrorActionPreference = "Stop"
10-
Set-StrictMode -Version 2.0
11-
12-
. $PSScriptRoot\..\tools.ps1
13-
14-
function Get-Headers([string]$accept, [string]$barToken) {
15-
$headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
16-
$headers.Add('Accept',$accept)
17-
$headers.Add('Authorization',"Bearer $barToken")
18-
return $headers
19-
}
9+
. $PSScriptRoot\post-build-utils.ps1
2010

2111
try {
22-
$maestroHeaders = Get-Headers 'application/json' $BarToken
12+
# Check that the channel we are going to promote the build to exist
13+
$channelInfo = Get-MaestroChannel -ChannelId $ChannelId
2314

24-
# Get info about which channels the build has already been promoted to
25-
$getBuildApiEndpoint = "$MaestroEndpoint/api/builds/${BuildId}?api-version=$ApiVersion"
26-
$buildInfo = Invoke-WebRequest -Method Get -Uri $getBuildApiEndpoint -Headers $maestroHeaders | ConvertFrom-Json
15+
if (!$channelInfo) {
16+
Write-Host "Channel with BAR ID $ChannelId was not found in BAR!"
17+
ExitWithExitCode 1
18+
}
2719

20+
# Get info about which channels the build has already been promoted to
21+
$buildInfo = Get-MaestroBuild -BuildId $BuildId
22+
2823
if (!$buildInfo) {
2924
Write-Host "Build with BAR ID $BuildId was not found in BAR!"
3025
ExitWithExitCode 1
@@ -40,10 +35,10 @@ try {
4035
}
4136
}
4237

43-
Write-Host "Build not present in channel $ChannelId. Promoting build ... "
38+
Write-Host "Promoting build '$BuildId' to channel '$ChannelId'."
39+
40+
Assign-BuildToChannel -BuildId $BuildId -ChannelId $ChannelId
4441

45-
$promoteBuildApiEndpoint = "$maestroEndpoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$ApiVersion"
46-
Invoke-WebRequest -Method Post -Uri $promoteBuildApiEndpoint -Headers $maestroHeaders
4742
Write-Host "done."
4843
}
4944
catch {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string] $ReleaseConfigsPath # Full path to ReleaseConfigs.txt asset
3+
)
4+
5+
. $PSScriptRoot\post-build-utils.ps1
6+
7+
try {
8+
$Content = Get-Content $ReleaseConfigsPath
9+
10+
$BarId = $Content | Select -Index 0
11+
12+
$Channels = ""
13+
$Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
14+
15+
$IsStableBuild = $Content | Select -Index 2
16+
17+
Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId
18+
Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels"
19+
Write-PipelineSetVariable -Name 'IsStableBuild' -Value $IsStableBuild
20+
}
21+
catch {
22+
Write-Host $_
23+
Write-Host $_.Exception
24+
Write-Host $_.ScriptStackTrace
25+
ExitWithExitCode 1
26+
}

eng/common/post-build/sourcelink-validation.ps1

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ param(
66
[Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use
77
)
88

9-
$ErrorActionPreference = "Stop"
10-
Set-StrictMode -Version 2.0
11-
12-
. $PSScriptRoot\..\tools.ps1
9+
. $PSScriptRoot\post-build-utils.ps1
1310

1411
# Cache/HashMap (File -> Exist flag) used to consult whether a file exist
1512
# in the repository at a specific commit point. This is populated by inserting
@@ -200,21 +197,27 @@ function ValidateSourceLinkLinks {
200197
}
201198
}
202199

203-
function CheckExitCode ([string]$stage) {
204-
$exitCode = $LASTEXITCODE
205-
if ($exitCode -ne 0) {
206-
Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..."
207-
ExitWithExitCode $exitCode
200+
function InstallSourcelinkCli {
201+
$sourcelinkCliPackageName = "sourcelink"
202+
203+
$dotnetRoot = InitializeDotNetCli -install:$true
204+
$dotnet = "$dotnetRoot\dotnet.exe"
205+
$toolList = & "$dotnet" tool list --global
206+
207+
if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) {
208+
Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed."
209+
}
210+
else {
211+
Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..."
212+
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
213+
& "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global
208214
}
209215
}
210216

211217
try {
212-
Write-Host "Installing SourceLink CLI..."
213-
Get-Location
214-
. $PSScriptRoot\sourcelink-cli-init.ps1 -sourcelinkCliVersion $SourcelinkCliVersion
215-
CheckExitCode "Running sourcelink-cli-init"
218+
InstallSourcelinkCli
216219

217-
Measure-Command { ValidateSourceLinkLinks }
220+
ValidateSourceLinkLinks
218221
}
219222
catch {
220223
Write-Host $_

eng/common/post-build/symbols-validation.ps1

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ param(
44
[Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use
55
)
66

7-
$ErrorActionPreference = "Stop"
8-
Set-StrictMode -Version 2.0
9-
10-
. $PSScriptRoot\..\tools.ps1
7+
. $PSScriptRoot\post-build-utils.ps1
118

129
Add-Type -AssemblyName System.IO.Compression.FileSystem
1310

@@ -162,19 +159,25 @@ function CheckSymbolsAvailable {
162159
}
163160
}
164161

165-
function CheckExitCode ([string]$stage) {
166-
$exitCode = $LASTEXITCODE
167-
if ($exitCode -ne 0) {
168-
Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..."
169-
ExitWithExitCode $exitCode
162+
function Installdotnetsymbol {
163+
$dotnetsymbolPackageName = "dotnet-symbol"
164+
165+
$dotnetRoot = InitializeDotNetCli -install:$true
166+
$dotnet = "$dotnetRoot\dotnet.exe"
167+
$toolList = & "$dotnet" tool list --global
168+
169+
if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) {
170+
Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed."
171+
}
172+
else {
173+
Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..."
174+
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
175+
& "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity "minimal" --global
170176
}
171177
}
172178

173179
try {
174-
Write-Host "Installing dotnet symbol ..."
175-
Get-Location
176-
. $PSScriptRoot\dotnetsymbol-init.ps1 -dotnetsymbolVersion $DotnetSymbolVersion
177-
CheckExitCode "Running dotnetsymbol-init"
180+
Installdotnetsymbol
178181

179182
CheckSymbolsAvailable
180183
}

0 commit comments

Comments
 (0)