Skip to content

Commit 1e6ef09

Browse files
authored
[release/v7.2.18] Back port three build changes to apiscan.yml (#21036)
1 parent eb817e3 commit 1e6ef09

File tree

1 file changed

+64
-0
lines changed
  • tools/releaseBuild/azureDevOps/templates/compliance

1 file changed

+64
-0
lines changed

tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- name: branchCounter
1818
value: $[counter(variables['branchCounterKey'], 1)]
1919
- group: DotNetPrivateBuildAccess
20+
- group: Azure Blob variable group
21+
- group: ReleasePipelineSecrets
22+
- group: AzDevOpsArtifacts
2023

2124
pool:
2225
name: PowerShell1ES
@@ -33,6 +36,10 @@ jobs:
3336
CreateJson: yes
3437
UseJson: no
3538

39+
- template: ../insert-nuget-config-azfeed.yml
40+
parameters:
41+
repoRoot: '$(Build.SourcesDirectory)'
42+
3643
- pwsh: |
3744
Import-Module .\build.psm1 -force
3845
Start-PSBootstrap
@@ -52,6 +59,29 @@ jobs:
5259
displayName: Install dotnet-symbol
5360
retryCountOnTaskFailure: 2
5461
62+
- pwsh: |
63+
Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1'
64+
Install-AzCopy
65+
displayName: Install AzCopy
66+
retryCountOnTaskFailure: 2
67+
68+
- pwsh: |
69+
Import-module '$(BUILD.SOURCESDIRECTORY)/build.psm1'
70+
$azcopy = Find-AzCopy
71+
Write-Verbose -Verbose "Found AzCopy: $azcopy"
72+
73+
$winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/winverify-symbols' -Force
74+
Write-Host "##vso[task.setvariable variable=winverifySymbolsPath]$winverifySymbolsPath"
75+
76+
& $azcopy cp https://$(StorageAccount).blob.core.windows.net/winverify-private $winverifySymbolsPath --recursive
77+
78+
Get-ChildItem $winverifySymbolsPath -Recurse | Out-String | Write-Verbose -Verbose
79+
80+
displayName: Download winverify-private Artifacts
81+
retryCountOnTaskFailure: 2
82+
env:
83+
AZCOPY_AUTO_LOGIN_TYPE: MSI
84+
5585
- pwsh: |
5686
Import-Module .\build.psm1 -force
5787
Find-DotNet
@@ -64,6 +94,39 @@ jobs:
6494
if (Test-Path $OutputFolder/ref) {
6595
Remove-Item -Recurse -Force $OutputFolder/ref
6696
}
97+
98+
$surrogateFileTemplate = @'
99+
<?xml version="1.0" encoding="utf-8"?>
100+
<APIScanSurrogates>
101+
<Mappings>
102+
<Mapping>
103+
<SurrogateSet>
104+
<BinarySet>
105+
<SymbolLocations>
106+
<SymbolLocation>{path_to_symbol}</SymbolLocation>
107+
</SymbolLocations>
108+
<Binary path="{path_to_dll}" />
109+
</BinarySet>
110+
</SurrogateSet>
111+
<Targets>
112+
<Binary path="{path_to_dll_in_build}" />
113+
</Targets>
114+
</Mapping>
115+
</Mappings>
116+
</APIScanSurrogates>
117+
'@
118+
119+
$pathToDll = Get-ChildItem -Path $OutputFolder -Filter 'getfilesiginforedist.dll' -Recurse | Where-Object { $_.fullname -like '*win-x64*' } | Select-Object -First 1 -ExpandProperty FullName
120+
121+
$surrogateFile = Join-Path $(Pipeline.Workspace) 'APIScanSurrogates.xml'
122+
$surrogateFileContent = $surrogateFileTemplate -replace '{path_to_symbol}', '$(winverifySymbolsPath)\winverify-private' -replace '{path_to_dll}', '$(winverifySymbolsPath)\winverify-private\getfilesiginforedist.dll' -replace '{path_to_dll_in_build}', $pathToDll
123+
$surrogateFileContent | Out-File -FilePath $surrogateFile -Force
124+
125+
Write-Verbose -Verbose -Message "Surrogate file content:"
126+
Get-Content -Path $surrogateFile -Raw | Out-String | Write-Verbose -Verbose
127+
128+
Write-Host "##vso[task.setvariable variable=surrogateFilePath]$(Pipeline.Workspace)"
129+
67130
workingDirectory: '$(Build.SourcesDirectory)'
68131
displayName: 'Build PowerShell Source'
69132
@@ -117,6 +180,7 @@ jobs:
117180
verbosityLevel: standard
118181
# write a status update every 5 minutes. Default is 1 minute
119182
statusUpdateInterval: '00:05:00'
183+
surrogateConfigurationFolder : $(surrogateFilePath)
120184
env:
121185
AzureServicesAuthConnectionString: RunAs=App;AppId=$(APIScanClient);TenantId=$(APIScanTenant);AppKey=$(APIScanSecret)
122186

0 commit comments

Comments
 (0)