Skip to content

Commit 2cac0e1

Browse files
[master] Update dependencies from dotnet/arcade (dotnet#6580)
* Update dependencies from https://github.com/dotnet/arcade build 20190418.4 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.4 * Update dependencies from https://github.com/dotnet/arcade build 20190418.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.7 * Update dependencies from https://github.com/dotnet/arcade build 20190422.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19222.2 * Update dependencies from https://github.com/dotnet/arcade build 20190423.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19223.2 * Update dependencies from https://github.com/dotnet/arcade build 20190424.9 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19224.9 * Update dependencies from https://github.com/dotnet/arcade build 20190425.5 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19225.5 * Update dependencies from https://github.com/dotnet/arcade build 20190426.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19226.3
1 parent 768f39c commit 2cac0e1

File tree

6 files changed

+194
-56
lines changed

6 files changed

+194
-56
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.19218.1">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19226.3">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>46718d98c0fd03690a6a8c83da692a4a85a17902</Sha>
8+
<Sha>7bec23ce3da545d97f53f99abce457a2e252aa58</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored
3+
[Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation
4+
[Parameter(Mandatory=$true)][string] $SourceLinkToolPath, # Full path to directory where dotnet SourceLink CLI was installed
5+
[Parameter(Mandatory=$true)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade
6+
[Parameter(Mandatory=$true)][string] $GHCommit # GitHub commit SHA used to build the packages
7+
)
8+
9+
# Cache/HashMap (File -> Exist flag) used to consult whether a file exist
10+
# in the repository at a specific commit point. This is populated by inserting
11+
# all files present in the repo at a specific commit point.
12+
$global:RepoFiles = @{}
13+
14+
$ValidatePackage = {
15+
param(
16+
[string] $PackagePath # Full path to a Symbols.NuGet package
17+
)
18+
19+
# Ensure input file exist
20+
if (!(Test-Path $PackagePath)) {
21+
throw "Input file does not exist: $PackagePath"
22+
}
23+
24+
# Extensions for which we'll look for SourceLink information
25+
# For now we'll only care about Portable & Embedded PDBs
26+
$RelevantExtensions = @(".dll", ".exe", ".pdb")
27+
28+
Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... "
29+
30+
$PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath)
31+
$ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId
32+
$FailedFiles = 0
33+
34+
Add-Type -AssemblyName System.IO.Compression.FileSystem
35+
36+
[System.IO.Directory]::CreateDirectory($ExtractPath);
37+
38+
$zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath)
39+
40+
$zip.Entries |
41+
Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} |
42+
ForEach-Object {
43+
$FileName = $_.FullName
44+
$Extension = [System.IO.Path]::GetExtension($_.Name)
45+
$FakeName = -Join((New-Guid), $Extension)
46+
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName
47+
48+
# We ignore resource DLLs
49+
if ($FileName.EndsWith(".resources.dll")) {
50+
return
51+
}
52+
53+
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true)
54+
55+
$ValidateFile = {
56+
param(
57+
[string] $FullPath, # Full path to the module that has to be checked
58+
[string] $RealPath,
59+
[ref] $FailedFiles
60+
)
61+
62+
# Makes easier to reference `sourcelink cli`
63+
Push-Location $using:SourceLinkToolPath
64+
65+
$SourceLinkInfos = .\sourcelink.exe print-urls $FullPath | Out-String
66+
67+
if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) {
68+
$NumFailedLinks = 0
69+
70+
# We only care about Http addresses
71+
$Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches
72+
73+
if ($Matches.Count -ne 0) {
74+
$Matches.Value |
75+
ForEach-Object {
76+
$Link = $_
77+
$CommitUrl = -Join("https://raw.githubusercontent.com/", $using:GHRepoName, "/", $using:GHCommit, "/")
78+
$FilePath = $Link.Replace($CommitUrl, "")
79+
$Status = 200
80+
$Cache = $using:RepoFiles
81+
82+
if ( !($Cache.ContainsKey($FilePath)) ) {
83+
try {
84+
$Uri = $Link -as [System.URI]
85+
86+
# Only GitHub links are valid
87+
if ($Uri.AbsoluteURI -ne $null -and $Uri.Host -match "github") {
88+
$Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode
89+
}
90+
else {
91+
$Status = 0
92+
}
93+
}
94+
catch {
95+
$Status = 0
96+
}
97+
}
98+
99+
if ($Status -ne 200) {
100+
if ($NumFailedLinks -eq 0) {
101+
if ($FailedFiles.Value -eq 0) {
102+
Write-Host
103+
}
104+
105+
Write-Host "`tFile $RealPath has broken links:"
106+
}
107+
108+
Write-Host "`t`tFailed to retrieve $Link"
109+
110+
$NumFailedLinks++
111+
}
112+
}
113+
}
114+
115+
if ($NumFailedLinks -ne 0) {
116+
$FailedFiles.value++
117+
$global:LASTEXITCODE = 1
118+
}
119+
}
120+
121+
Pop-Location
122+
}
123+
124+
&$ValidateFile $TargetFile $FileName ([ref]$FailedFiles)
125+
}
126+
127+
$zip.Dispose()
128+
129+
if ($FailedFiles -eq 0) {
130+
Write-Host "Passed."
131+
}
132+
}
133+
134+
function ValidateSourceLinkLinks {
135+
if (!($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) {
136+
Write-Host "GHRepoName should be in the format <org>/<repo>"
137+
$global:LASTEXITCODE = 1
138+
return
139+
}
140+
141+
if (!($GHCommit -Match "^[0-9a-fA-F]{40}$")) {
142+
Write-Host "GHCommit should be a 40 chars hexadecimal string"
143+
$global:LASTEXITCODE = 1
144+
return
145+
}
146+
147+
$RepoTreeURL = -Join("https://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1")
148+
$CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript")
149+
150+
try {
151+
# Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash
152+
$Data = Invoke-WebRequest $RepoTreeURL | ConvertFrom-Json | Select-Object -ExpandProperty tree
153+
154+
foreach ($file in $Data) {
155+
$Extension = [System.IO.Path]::GetExtension($file.path)
156+
157+
if ($CodeExtensions.Contains($Extension)) {
158+
$RepoFiles[$file.path] = 1
159+
}
160+
}
161+
}
162+
catch {
163+
Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL"
164+
$global:LASTEXITCODE = 1
165+
return
166+
}
167+
168+
if (Test-Path $ExtractPath) {
169+
Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue
170+
}
171+
172+
# Process each NuGet package in parallel
173+
$Jobs = @()
174+
Get-ChildItem "$InputPath\*.symbols.nupkg" |
175+
ForEach-Object {
176+
$Jobs += Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName
177+
}
178+
179+
foreach ($Job in $Jobs) {
180+
Wait-Job -Id $Job.Id | Receive-Job
181+
}
182+
}
183+
184+
Measure-Command { ValidateSourceLinkLinks }

eng/common/templates/job/job.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ parameters:
4343
# Optional: enable sending telemetry
4444
enableTelemetry: false
4545

46-
# Optional: define the helix repo for telemeetry (example: 'dotnet/arcade')
46+
# Optional: define the helix repo for telemetry (example: 'dotnet/arcade')
4747
helixRepo: ''
4848

49+
# Optional: define the helix type for telemetry (example: 'build/product/')
50+
helixType: ''
51+
4952
# Required: name of the job
5053
name: ''
5154

@@ -122,6 +125,8 @@ jobs:
122125
displayName: 'Send Helix Start Telemetry'
123126
inputs:
124127
helixRepo: ${{ parameters.helixRepo }}
128+
${{ if ne(parameters.helixType, '') }}:
129+
helixType: ${{ parameters.helixType }}
125130
buildConfig: $(_BuildConfig)
126131
runAsPublic: ${{ parameters.runAsPublic }}
127132
continueOnError: ${{ parameters.continueOnError }}

eng/common/templates/steps/helix-publish.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

eng/common/templates/steps/send-to-helix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ parameters:
2323
WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget."
2424
IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set
2525
Creator: '' # optional -- if the build is external, use this to specify who is sending the job
26-
DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO
26+
DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO
2727
condition: succeeded() # optional -- condition for step to execute; defaults to succeeded()
2828
continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false
2929

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.1",
13+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19226.3",
1414
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1515
}
1616
}

0 commit comments

Comments
 (0)