@@ -12,32 +12,17 @@ jobs:
1212 value : false
1313 - name : NugetSecurityAnalysisWarningLevel
1414 value : none
15- # PAT permissions NOTE: Declare a SymbolServerPAT variable in this group with a 'microsoft' organizanization scoped PAT with 'Symbols' Read permission.
16- # A PAT in the wrong org will give a single Error 203. No PAT will give a single Error 401, and individual pdbs may be missing even if permissions are correct.
17- - group : symbols
1815 # Defines the variables APIScanClient, APIScanTenant and APIScanSecret
1916 - group : PS-PS-APIScan
20- - group : DotNetPrivateBuildAccess
2117 - group : ' Azure Blob variable group'
22- - group : ReleasePipelineSecrets
2318 - group : mscodehub-feed-read-general
2419 - group : mscodehub-feed-read-akv
2520 - name : ob_outputDirectory
26- value : ' $(Build.ArtifactStagingDirectory)/ ONEBRANCH_ARTIFACT'
21+ value : ' $(Build.ArtifactStagingDirectory)\ ONEBRANCH_ARTIFACT'
2722 - name : repoRoot
2823 value : $(Build.SourcesDirectory)\AIShell
2924 - name : ob_sdl_tsa_configFile
3025 value : $(repoRoot)\.config\tsaoptions.json
31- - name : ob_sdl_apiscan_enabled
32- value : true
33- - name : ob_sdl_apiscan_softwareName
34- value : ' AIShell'
35- - name : ob_sdl_apiscan_versionNumber
36- value : ' 1.0'
37- - name : ob_sdl_apiscan_isLargeApp
38- value : false
39- - name : ob_sdl_apiscan_symbolsFolder
40- value : $(SymbolsServerUrl);$(ob_outputDirectory)
4126 - name : Codeql.SourceRoot
4227 value : $(repoRoot)
4328
5439 env :
5540 ob_restore_phase : true # This ensures checkout is done at the beginning of the restore phase
5641
57- - template : update-nuget-config.yml@self
42+ - template : ..\ update-nuget-config.yml@self
5843 parameters :
5944 repoRoot : $(repoRoot)
6045
@@ -65,13 +50,13 @@ jobs:
6550 packageType : ' sdk'
6651 workingDirectory : $(Build.SourcesDirectory)"
6752
68- - pwsh : |
69- dotnet tool install dotnet-symbol --tool-path $(Agent.ToolsDirectory)\tools\dotnet-symbol
70- $symbolToolPath = Get-ChildItem -Path $(Agent.ToolsDirectory)\tools\dotnet-symbol\dotnet-symbol.exe | Select-Object -First 1 -ExpandProperty FullName
71- Write-Host "##vso[task.setvariable variable=symbolToolPath]$symbolToolPath"
72- displayName: Install dotnet-symbol
73- workingDirectory: '$(repoRoot)'
74- retryCountOnTaskFailure: 2
53+ # - pwsh: |
54+ # dotnet tool install dotnet-symbol --tool-path $(Agent.ToolsDirectory)\tools\dotnet-symbol
55+ # $symbolToolPath = Get-ChildItem -Path $(Agent.ToolsDirectory)\tools\dotnet-symbol\dotnet-symbol.exe | Select-Object -First 1 -ExpandProperty FullName
56+ # Write-Host "##vso[task.setvariable variable=symbolToolPath]$symbolToolPath"
57+ # displayName: Install dotnet-symbol
58+ # workingDirectory: '$(repoRoot)'
59+ # retryCountOnTaskFailure: 2
7560
7661 - task : AzurePowerShell@5
7762 displayName : Download winverify-private Artifacts
@@ -85,15 +70,15 @@ jobs:
8570 # download smybols for getfilesiginforedist.dll
8671 $storageAccountName = "pscoretestdata"
8772 $containerName = 'winverify-private'
88- $winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/ winverify-symbols' -Force
73+ $winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)\ winverify-symbols' -Force
8974 $dllName = 'getfilesiginforedist.dll'
9075 $winverifySymbolsDllPath = Join-Path $winverifySymbolsPath $dllName
9176
9277 $context = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount
9378 Get-AzStorageBlobContent -Container $containerName -Blob $dllName -Destination $winverifySymbolsDllPath -Context $context
9479
9580 - pwsh : |
96- Get-ChildItem -Path '$(System.ArtifactsDirectory)/ winverify-symbols'
81+ Get-ChildItem -Path '$(System.ArtifactsDirectory)\ winverify-symbols'
9782 displayName: Capture winverify-private Artifacts
9883 workingDirectory: '$(repoRoot)'
9984 condition: succeededOrFailed()
@@ -105,42 +90,70 @@ jobs:
10590 Language : csharp
10691
10792 - pwsh : |
108- Import-Module $(repoRoot)/ build.psm1 -Force
93+ Import-Module ' $(repoRoot)\ build.psm1' -Force
10994 Start-Build -Configuration StaticAnalysis -Runtime fxdependent -Clean -Verbose
11095
111- $outputJson = '$(repoRoot)/ _build_output_.json'
96+ $outputJson = '$(repoRoot)\ _build_output_.json'
11297 if (-not (Test-Path $outputJson)) {
11398 throw "'_build_output_.json' was not produced."
11499 }
115100
116101 $result = Get-Content $outputJson | ConvertFrom-Json
117- Write-Verbose "App path: $($result.App)" -Verbose
118102 $OutputFolder = $result.App
103+ Write-Verbose "App path: $OutputFolder" -Verbose
104+
105+ Write-Verbose -Verbose -Message "Deleting the 'ref' folder ..."
106+ if (Test-Path $OutputFolder\ref) {
107+ Remove-Item -Recurse -Force $OutputFolder\ref
108+ }
119109
120- Write-Verbose -Verbose -Message "Deleting ref folder from output folder"
121- if (Test-Path $OutputFolder/ref) {
122- Remove-Item -Recurse -Force $OutputFolder/ref
110+ # Only keep windows runtimes
111+ Write-Verbose -Verbose -Message "Deleting non-win-x64 runtimes ..."
112+ Get-ChildItem -Path "$OutputFolder\runtimes\*" | Where-Object {$_.FullName -notmatch '.*\\runtimes\\win'} | Foreach-Object {
113+ Write-Verbose -Verbose -Message "Deleting $($_.FullName)"
114+ Remove-Item -Path $_.FullName -Recurse -Force
123115 }
124116
125- Copy-Item -Path "$OutputFolder\*" -Destination '$(ob_outputDirectory)' -Recurse -Verbose
117+ # Remove win-x86/arm/arm64 runtimes due to issues with those runtimes
118+ Write-Verbose -Verbose -Message "Temporarily deleting win-x86/arm/arm64 runtimes ..."
119+ Get-ChildItem -Path "$OutputFolder\runtimes\*" | Where-Object {$_.FullName -match '.*\\runtimes\\win-(x86|arm)'} | Foreach-Object {
120+ Write-Verbose -Verbose -Message "Deleting $($_.FullName)"
121+ Remove-Item -Path $_.FullName -Recurse -Force
122+ }
123+
124+ Write-Host
125+ Write-Verbose -Verbose -Message "Show content in 'runtimes' folder:"
126+ Get-ChildItem -Path "$OutputFolder\runtimes"
127+ Write-Host
128+
129+ # Replace 'getfilesiginforedist.dll' from the 'runtimes\win-x64' folder
130+ Write-Verbose -Verbose -Message "Replace 'getfilesiginforedist.dll':"
131+ $targetFile = Get-ChildItem -Path "$OutputFolder\runtimes\*" -Recurse | Where-Object {$_.Name -eq 'getfilesiginforedist.dll'}
132+ Remove-Item -Path $targetFile.FullName -Verbose
133+ Copy-Item -Path '$(System.ArtifactsDirectory)\winverify-symbols\getfilesiginforedist.dll' -Destination $targetFile.FullName -Verbose
134+
135+ Write-Host "##vso[task.setvariable variable=appPath]$OutputFolder"
126136 workingDirectory: '$(repoRoot)'
127137 displayName: 'Build AIShell Source'
128138
129139 - pwsh : |
130- # Only key windows runtimes
131- Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' -File -Recurse | Where-Object {$_.FullName -notmatch '.*\/runtimes\/win'} | Foreach-Object {
132- Write-Verbose -Verbose -Message "Deleting $($_.FullName) "
133- Remove-Item -Force -Verbose -Path $_.FullName
140+ $Destination = '$(ob_outputDirectory)'
141+ if (-not (Test-Path $Destination)) {
142+ Write-Verbose -Verbose -Message "Creating destination folder '$Destination' "
143+ $null = mkdir $Destination
134144 }
135145
136- # Temporarily remove runtimes/win-x86 due to issues with that runtime
137- Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' -File -Recurse | Where-Object {$_.FullName -match '.*\/runtimes\/win-x86\/'} | Foreach-Object {
138- Write-Verbose -Verbose -Message "Deleting $($_.FullName)"
139- Remove-Item -Force -Verbose -Path $_.FullName
140- }
146+ Write-Verbose -Verbose -Message "Copy AIShell app to '$Destination':"
147+ Copy-Item -Path '$(appPath)\*' -Destination $Destination -Recurse -Verbose
141148
149+ Write-Host
150+ Write-Verbose -Verbose -Message "Show content in '$Destination':"
151+ Get-ChildItem -Path $Destination | Out-String -width 150
152+ Write-Host
153+ Write-Verbose -Verbose -Message "Show content in '$Destination\runtimes':"
154+ Get-ChildItem -Path "$Destination\runtimes" -Recurse | Out-String -width 150
142155 workingDirectory: '$(repoRoot)'
143- displayName: 'Remove unused runtimes '
156+ displayName: 'Copy AIShell to ob_outputDirectory '
144157
145158 - task : CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
146159 displayName : 🔏 CodeQL 3000 Finalize
@@ -153,16 +166,17 @@ jobs:
153166 condition: succeededOrFailed()
154167
155168 # Explicitly download symbols for the drop since the SDL image doesn't have http://SymWeb access and APIScan cannot handle https yet.
156- - pwsh : |
157- $pat = '$(SymbolServerPAT)'
158- if ($pat -like '*PAT*' -or $pat -eq '') {
159- throw 'No PAT defined'
160- }
161- $url = 'https://microsoft.artifacts.visualstudio.com/defaultcollection/_apis/symbol/symsrv'
162- $(symbolToolPath) --authenticated-server-path $(SymbolServerPAT) $url --symbols -d "$env:ob_outputDirectory\*" --recurse-subdirectories
163- displayName: 'Download Symbols for binaries'
164- retryCountOnTaskFailure: 2
165- workingDirectory: '$(repoRoot)'
169+ # - pwsh: |
170+ # $pat = '$(SymbolServerPAT)'
171+ # if ($pat -like '*PAT*' -or $pat -eq '')
172+ # {
173+ # throw 'No PAT defined'
174+ # }
175+ # $url = 'https://microsoft.artifacts.visualstudio.com/defaultcollection/_apis/symbol/symsrv'
176+ # $(symbolToolPath) --authenticated-server-path $(SymbolServerPAT) $url --symbols -d "$env:ob_outputDirectory\*" --recurse-subdirectories
177+ # displayName: 'Download Symbols for binaries'
178+ # retryCountOnTaskFailure: 2
179+ # workingDirectory: '$(repoRoot)'
166180
167181 - pwsh : |
168182 Get-ChildItem '$(ob_outputDirectory)' -File -Recurse |
@@ -173,16 +187,10 @@ jobs:
173187 Md5Hash = (Get-FileHash -Algorithm MD5 -Path $_.FullName).Hash
174188 Sha512Hash = (Get-FileHash -Algorithm SHA512 -Path $_.FullName).Hash
175189 }
176- } | Export-Csv -Path '$(Build.SourcesDirectory)/ ReleaseFileHash.csv'
190+ } | Export-Csv -Path '$(Build.SourcesDirectory)\ ReleaseFileHash.csv'
177191 workingDirectory: '$(repoRoot)'
178192 displayName: 'Create release file hash artifact'
179193
180194 - pwsh : |
181- Copy-Item -Path '$(Build.SourcesDirectory)/ ReleaseFileHash.csv' -Destination '$(ob_outputDirectory)' -Verbose
195+ Copy-Item -Path '$(Build.SourcesDirectory)\ ReleaseFileHash.csv' -Destination '$(ob_outputDirectory)' -Verbose
182196 displayName: 'Publish Build File Hash artifact'
183-
184- - pwsh : |
185- Get-ChildItem -Path env: | Out-String -width 150 -Stream | write-Verbose -Verbose
186- displayName: Capture Environment
187- condition: succeededOrFailed()
188- workingDirectory: '$(repoRoot)'
0 commit comments