Skip to content

Commit 787d4c5

Browse files
author
dotnet-automerge-bot
authored
Merge pull request #7092 from dotnet/merges/master-to-release/dev16.3
Merge master to release/dev16.3
2 parents 459162b + 5306722 commit 787d4c5

20 files changed

Lines changed: 720 additions & 64 deletions

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<solution>
44
<add key="disableSourceControlIntegration" value="true" />

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.19323.4">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19330.1">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>9946534da4f73e6242ca105f6798ab58119c9ab0</Sha>
8+
<Sha>89fab80685c91024c8f9e21f1c37f62580f648f8</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This script validates NuGet package metadata information using this
2+
# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage
3+
4+
param(
5+
[Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are
6+
[Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to
7+
)
8+
9+
$ErrorActionPreference = "Stop"
10+
Set-StrictMode -Version 2.0
11+
12+
. $PSScriptRoot\..\tools.ps1
13+
14+
try {
15+
$url = "https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1"
16+
17+
New-Item -ItemType "directory" -Path ${ToolDestinationPath} -Force
18+
19+
Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1
20+
21+
& ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg
22+
}
23+
catch {
24+
Write-PipelineTaskError "NuGet package validation failed. Please check error logs."
25+
Write-Host $_
26+
Write-Host $_.ScriptStackTrace
27+
ExitWithExitCode 1
28+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
param(
2+
[Parameter(Mandatory=$true)][int] $BuildId,
3+
[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"
7+
)
8+
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+
}
20+
21+
try {
22+
$maestroHeaders = Get-Headers 'application/json' $BarToken
23+
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
27+
28+
if (!$buildInfo) {
29+
Write-Host "Build with BAR ID $BuildId was not found in BAR!"
30+
ExitWithExitCode 1
31+
}
32+
33+
# Find whether the build is already assigned to the channel or not
34+
if ($buildInfo.channels) {
35+
foreach ($channel in $buildInfo.channels) {
36+
if ($channel.Id -eq $ChannelId) {
37+
Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!"
38+
ExitWithExitCode 0
39+
}
40+
}
41+
}
42+
43+
Write-Host "Build not present in channel $ChannelId. Promoting build ... "
44+
45+
$promoteBuildApiEndpoint = "$maestroEndpoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$ApiVersion"
46+
Invoke-WebRequest -Method Post -Uri $promoteBuildApiEndpoint -Headers $maestroHeaders
47+
Write-Host "done."
48+
}
49+
catch {
50+
Write-Host "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'"
51+
Write-Host $_
52+
Write-Host $_.ScriptStackTrace
53+
}

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ Set-StrictMode -Version 2.0
1111

1212
. $PSScriptRoot\..\tools.ps1
1313

14-
# Cache/HashMap (File -> Exist flag) used to consult whether a file exist
14+
# Cache/HashMap (File -> Exist flag) used to consult whether a file exist
1515
# in the repository at a specific commit point. This is populated by inserting
1616
# all files present in the repo at a specific commit point.
1717
$global:RepoFiles = @{}
1818

1919
$ValidatePackage = {
20-
param(
20+
param(
2121
[string] $PackagePath # Full path to a Symbols.NuGet package
2222
)
2323

@@ -32,7 +32,7 @@ $ValidatePackage = {
3232
# Extensions for which we'll look for SourceLink information
3333
# For now we'll only care about Portable & Embedded PDBs
3434
$RelevantExtensions = @(".dll", ".exe", ".pdb")
35-
35+
3636
Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... "
3737

3838
$PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath)
@@ -46,13 +46,13 @@ $ValidatePackage = {
4646
try {
4747
$zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath)
4848

49-
$zip.Entries |
49+
$zip.Entries |
5050
Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} |
5151
ForEach-Object {
5252
$FileName = $_.FullName
5353
$Extension = [System.IO.Path]::GetExtension($_.Name)
5454
$FakeName = -Join((New-Guid), $Extension)
55-
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName
55+
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName
5656

5757
# We ignore resource DLLs
5858
if ($FileName.EndsWith(".resources.dll")) {
@@ -62,7 +62,7 @@ $ValidatePackage = {
6262
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true)
6363

6464
$ValidateFile = {
65-
param(
65+
param(
6666
[string] $FullPath, # Full path to the module that has to be checked
6767
[string] $RealPath,
6868
[ref] $FailedFiles
@@ -83,15 +83,15 @@ $ValidatePackage = {
8383
ForEach-Object {
8484
$Link = $_
8585
$CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/"
86-
86+
8787
$FilePath = $Link.Replace($CommitUrl, "")
8888
$Status = 200
8989
$Cache = $using:RepoFiles
9090

9191
if ( !($Cache.ContainsKey($FilePath)) ) {
9292
try {
9393
$Uri = $Link -as [System.URI]
94-
94+
9595
# Only GitHub links are valid
9696
if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match "github" -or $Uri.Host -match "githubusercontent")) {
9797
$Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode
@@ -128,15 +128,15 @@ $ValidatePackage = {
128128
}
129129
}
130130
}
131-
131+
132132
&$ValidateFile $TargetFile $FileName ([ref]$FailedFiles)
133133
}
134134
}
135135
catch {
136-
136+
137137
}
138138
finally {
139-
$zip.Dispose()
139+
$zip.Dispose()
140140
}
141141

142142
if ($FailedFiles -eq 0) {
@@ -163,13 +163,13 @@ function ValidateSourceLinkLinks {
163163
ExitWithExitCode 1
164164
}
165165

166-
$RepoTreeURL = -Join("https://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1")
166+
$RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1")
167167
$CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript")
168168

169169
try {
170170
# Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash
171171
$Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree
172-
172+
173173
foreach ($file in $Data) {
174174
$Extension = [System.IO.Path]::GetExtension($file.path)
175175

@@ -183,7 +183,7 @@ function ValidateSourceLinkLinks {
183183
Write-Host $_
184184
ExitWithExitCode 1
185185
}
186-
186+
187187
if (Test-Path $ExtractPath) {
188188
Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue
189189
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string] $SourceRepo,
3+
[Parameter(Mandatory=$true)][int] $ChannelId,
4+
[string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com",
5+
[string] $BarToken,
6+
[string] $ApiVersion = "2019-01-16"
7+
)
8+
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+
}
20+
21+
# Get all the $SourceRepo subscriptions
22+
$normalizedSurceRepo = $SourceRepo.Replace('dnceng@', '')
23+
$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSurceRepo&api-version=$apiVersion"
24+
$headers = Get-Headers 'application/json' $barToken
25+
26+
$subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json
27+
28+
if (!$subscriptions) {
29+
Write-Host "No subscriptions found for source repo '$normalizedSurceRepo' in channel '$ChannelId'"
30+
return
31+
}
32+
33+
$subscriptionsToTrigger = New-Object System.Collections.Generic.List[string]
34+
$failedTriggeredSubscription = $false
35+
36+
# Get all enabled subscriptions that need dependency flow on 'everyBuild'
37+
foreach ($subscription in $subscriptions) {
38+
if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) {
39+
Write-Host "$subscription.id"
40+
[void]$subscriptionsToTrigger.Add($subscription.id)
41+
}
42+
}
43+
44+
foreach ($subscriptionToTrigger in $subscriptionsToTrigger) {
45+
try {
46+
$triggerSubscriptionApiEndpoint = "$maestroEndpoint/api/subscriptions/$subscriptionToTrigger/trigger?api-version=$apiVersion"
47+
$headers = Get-Headers 'application/json' $BarToken
48+
49+
Write-Host "Triggering subscription '$subscriptionToTrigger'..."
50+
51+
Invoke-WebRequest -Uri $triggerSubscriptionApiEndpoint -Headers $headers -Method Post
52+
53+
Write-Host "Subscription '$subscriptionToTrigger' triggered!"
54+
}
55+
catch
56+
{
57+
Write-Host "There was an error while triggering subscription '$subscriptionToTrigger'"
58+
Write-Host $_
59+
Write-Host $_.ScriptStackTrace
60+
$failedTriggeredSubscription = $true
61+
}
62+
}
63+
64+
if ($failedTriggeredSubscription) {
65+
Write-Host "At least one subscription failed to be triggered..."
66+
ExitWithExitCode 1
67+
}
68+
69+
Write-Host "All subscriptions were triggered successfully!"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored
3+
[Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted
4+
)
5+
6+
$ErrorActionPreference = "Stop"
7+
Set-StrictMode -Version 2.0
8+
$ExtractPackage = {
9+
param(
10+
[string] $PackagePath # Full path to a NuGet package
11+
)
12+
13+
if (!(Test-Path $PackagePath)) {
14+
Write-PipelineTaskError "Input file does not exist: $PackagePath"
15+
ExitWithExitCode 1
16+
}
17+
18+
$RelevantExtensions = @(".dll", ".exe", ".pdb")
19+
Write-Host -NoNewLine "Extracting" ([System.IO.Path]::GetFileName($PackagePath)) "... "
20+
21+
$PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath)
22+
$ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId
23+
24+
Add-Type -AssemblyName System.IO.Compression.FileSystem
25+
26+
[System.IO.Directory]::CreateDirectory($ExtractPath);
27+
28+
try {
29+
$zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath)
30+
31+
$zip.Entries |
32+
Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} |
33+
ForEach-Object {
34+
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.Name
35+
36+
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true)
37+
}
38+
}
39+
catch {
40+
41+
}
42+
finally {
43+
$zip.Dispose()
44+
}
45+
}
46+
function ExtractArtifacts {
47+
if (!(Test-Path $InputPath)) {
48+
Write-Host "Input Path does not exist: $InputPath"
49+
ExitWithExitCode 0
50+
}
51+
$Jobs = @()
52+
Get-ChildItem "$InputPath\*.nupkg" |
53+
ForEach-Object {
54+
$Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName
55+
}
56+
57+
foreach ($Job in $Jobs) {
58+
Wait-Job -Id $Job.Id | Receive-Job
59+
}
60+
}
61+
62+
try {
63+
Measure-Command { ExtractArtifacts }
64+
}
65+
catch {
66+
Write-Host $_
67+
Write-Host $_.Exception
68+
Write-Host $_.ScriptStackTrace
69+
ExitWithExitCode 1
70+
}

eng/common/sdl/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Guardian.Cli" version="0.3.2"/>
3+
<package id="Microsoft.Guardian.Cli" version="0.6.0"/>
44
</packages>

eng/common/templates/job/execute-sdl.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ jobs:
2020
downloadType: specific files
2121
matchingPattern: "**"
2222
downloadPath: $(Build.SourcesDirectory)\artifacts
23+
- powershell: eng/common/sdl/extract-artifact-packages.ps1
24+
-InputPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts
25+
-ExtractPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts
26+
displayName: Extract Blob Artifacts
27+
continueOnError: ${{ parameters.continueOnError }}
28+
- powershell: eng/common/sdl/extract-artifact-packages.ps1
29+
-InputPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts
30+
-ExtractPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts
31+
displayName: Extract Package Artifacts
32+
continueOnError: ${{ parameters.continueOnError }}
2333
- task: NuGetToolInstaller@1
2434
displayName: 'Install NuGet.exe'
2535
- task: NuGetCommand@2
@@ -36,7 +46,7 @@ jobs:
3646
continueOnError: ${{ parameters.continueOnError }}
3747
- ${{ if eq(parameters.overrideParameters, '') }}:
3848
- powershell: eng/common/sdl/execute-all-sdl-tools.ps1
39-
-GuardianPackageName Microsoft.Guardian.Cli.0.3.2
49+
-GuardianPackageName Microsoft.Guardian.Cli.0.6.0
4050
-NugetPackageDirectory $(Build.SourcesDirectory)\.packages
4151
-AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
4252
${{ parameters.additionalParameters }}

eng/common/templates/job/publish-build-assets.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
script: |
6767
Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId)
6868
Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)"
69-
Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsInternalBuild)
7069
Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild)
7170
- task: PublishBuildArtifacts@1
7271
displayName: Publish ReleaseConfigs Artifact

0 commit comments

Comments
 (0)