@@ -12,32 +12,17 @@ jobs:
12
12
value : false
13
13
- name : NugetSecurityAnalysisWarningLevel
14
14
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
18
15
# Defines the variables APIScanClient, APIScanTenant and APIScanSecret
19
16
- group : PS-PS-APIScan
20
- - group : DotNetPrivateBuildAccess
21
17
- group : ' Azure Blob variable group'
22
- - group : ReleasePipelineSecrets
23
18
- group : mscodehub-feed-read-general
24
19
- group : mscodehub-feed-read-akv
25
20
- name : ob_outputDirectory
26
- value : ' $(Build.ArtifactStagingDirectory)/ ONEBRANCH_ARTIFACT'
21
+ value : ' $(Build.ArtifactStagingDirectory)\ ONEBRANCH_ARTIFACT'
27
22
- name : repoRoot
28
23
value : $(Build.SourcesDirectory)\AIShell
29
24
- name : ob_sdl_tsa_configFile
30
25
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)
41
26
- name : Codeql.SourceRoot
42
27
value : $(repoRoot)
43
28
54
39
env :
55
40
ob_restore_phase : true # This ensures checkout is done at the beginning of the restore phase
56
41
57
- - template : update-nuget-config.yml@self
42
+ - template : ..\ update-nuget-config.yml@self
58
43
parameters :
59
44
repoRoot : $(repoRoot)
60
45
@@ -65,13 +50,13 @@ jobs:
65
50
packageType : ' sdk'
66
51
workingDirectory : $(Build.SourcesDirectory)"
67
52
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
75
60
76
61
- task : AzurePowerShell@5
77
62
displayName : Download winverify-private Artifacts
@@ -85,15 +70,15 @@ jobs:
85
70
# download smybols for getfilesiginforedist.dll
86
71
$storageAccountName = "pscoretestdata"
87
72
$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
89
74
$dllName = 'getfilesiginforedist.dll'
90
75
$winverifySymbolsDllPath = Join-Path $winverifySymbolsPath $dllName
91
76
92
77
$context = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount
93
78
Get-AzStorageBlobContent -Container $containerName -Blob $dllName -Destination $winverifySymbolsDllPath -Context $context
94
79
95
80
- pwsh : |
96
- Get-ChildItem -Path '$(System.ArtifactsDirectory)/ winverify-symbols'
81
+ Get-ChildItem -Path '$(System.ArtifactsDirectory)\ winverify-symbols'
97
82
displayName: Capture winverify-private Artifacts
98
83
workingDirectory: '$(repoRoot)'
99
84
condition: succeededOrFailed()
@@ -105,42 +90,70 @@ jobs:
105
90
Language : csharp
106
91
107
92
- pwsh : |
108
- Import-Module $(repoRoot)/ build.psm1 -Force
93
+ Import-Module ' $(repoRoot)\ build.psm1' -Force
109
94
Start-Build -Configuration StaticAnalysis -Runtime fxdependent -Clean -Verbose
110
95
111
- $outputJson = '$(repoRoot)/ _build_output_.json'
96
+ $outputJson = '$(repoRoot)\ _build_output_.json'
112
97
if (-not (Test-Path $outputJson)) {
113
98
throw "'_build_output_.json' was not produced."
114
99
}
115
100
116
101
$result = Get-Content $outputJson | ConvertFrom-Json
117
- Write-Verbose "App path: $($result.App)" -Verbose
118
102
$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
+ }
119
109
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
123
115
}
124
116
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"
126
136
workingDirectory: '$(repoRoot)'
127
137
displayName: 'Build AIShell Source'
128
138
129
139
- 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
134
144
}
135
145
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
141
148
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
142
155
workingDirectory: '$(repoRoot)'
143
- displayName: 'Remove unused runtimes '
156
+ displayName: 'Copy AIShell to ob_outputDirectory '
144
157
145
158
- task : CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
146
159
displayName : 🔏 CodeQL 3000 Finalize
@@ -153,16 +166,17 @@ jobs:
153
166
condition: succeededOrFailed()
154
167
155
168
# 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)'
166
180
167
181
- pwsh : |
168
182
Get-ChildItem '$(ob_outputDirectory)' -File -Recurse |
@@ -173,16 +187,10 @@ jobs:
173
187
Md5Hash = (Get-FileHash -Algorithm MD5 -Path $_.FullName).Hash
174
188
Sha512Hash = (Get-FileHash -Algorithm SHA512 -Path $_.FullName).Hash
175
189
}
176
- } | Export-Csv -Path '$(Build.SourcesDirectory)/ ReleaseFileHash.csv'
190
+ } | Export-Csv -Path '$(Build.SourcesDirectory)\ ReleaseFileHash.csv'
177
191
workingDirectory: '$(repoRoot)'
178
192
displayName: 'Create release file hash artifact'
179
193
180
194
- 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
182
196
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