Skip to content

Commit e64f32e

Browse files
authored
Merge the 1.0.0-preview.7 release branch back to main (#414)
2 parents 9103bd8 + 4eac58e commit e64f32e

22 files changed

+352
-31
lines changed

.github/workflows/dotnet.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup .NET
2121
uses: actions/setup-dotnet@v4
2222
with:
23-
dotnet-version: 8.0.411
23+
dotnet-version: 8.0.413
2424
- name: Build
2525
shell: pwsh
2626
run: |
@@ -37,7 +37,7 @@ jobs:
3737
- name: Setup .NET
3838
uses: actions/setup-dotnet@v4
3939
with:
40-
dotnet-version: 8.0.411
40+
dotnet-version: 8.0.413
4141
- name: Build
4242
shell: pwsh
4343
run: |
@@ -54,7 +54,7 @@ jobs:
5454
- name: Setup .NET
5555
uses: actions/setup-dotnet@v4
5656
with:
57-
dotnet-version: 8.0.411
57+
dotnet-version: 8.0.413
5858
- name: Build
5959
shell: pwsh
6060
run: |

.pipelines/APIScan.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
name: apiscan-$(BUILD.SOURCEBRANCHNAME)-$(Build.BuildId)
5+
trigger: none
6+
7+
parameters:
8+
- name: FORCE_CODEQL
9+
displayName: Debugging - Enable CodeQL and set cadence to 1 hour
10+
type: boolean
11+
default: false
12+
- name: SkipVerifyPackages
13+
type: boolean
14+
default: false
15+
16+
variables:
17+
# PAT permissions NOTE: Declare a SymbolServerPAT variable in this group with a 'microsoft' organizanization scoped PAT with 'Symbols' Read permission.
18+
# 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.
19+
- group: symbols
20+
- name: ob_outputDirectory
21+
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
22+
- name: CDP_DEFINITION_BUILD_COUNT
23+
value: $[counter('', 0)]
24+
# Defines the variables CgPat, CgOrganization, and CgProject
25+
- group: 'ComponentGovernance'
26+
- group: 'PoolNames'
27+
- name: LinuxContainerImage
28+
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0
29+
- name: WindowsContainerImage
30+
value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
31+
- ${{ if eq(parameters['FORCE_CODEQL'],'true') }}:
32+
# Cadence is hours before CodeQL will allow a re-upload of the database
33+
- name: CodeQL.Cadence
34+
value: 0
35+
- name: CODEQL_ENABLED
36+
${{ if or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(parameters['FORCE_CODEQL'],'true')) }}:
37+
value: true
38+
${{ else }}:
39+
value: false
40+
- name: Codeql.TSAEnabled
41+
value: $(CODEQL_ENABLED)
42+
# AnalyzeInPipeline: false = upload results
43+
# AnalyzeInPipeline: true = do not upload results
44+
- name: Codeql.AnalyzeInPipeline
45+
value: $(CODEQL_ENABLED)
46+
47+
resources:
48+
repositories:
49+
- repository: templates
50+
type: git
51+
name: OneBranch.Pipelines/GovernedTemplates
52+
ref: refs/heads/main
53+
54+
extends:
55+
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates
56+
parameters:
57+
featureFlags:
58+
WindowsHostVersion:
59+
Version: 2022
60+
globalSdl:
61+
codeql:
62+
compiled:
63+
enabled: $(CODEQL_ENABLED)
64+
tsaEnabled: $(CODEQL_ENABLED) # This enables TSA bug filing only for CodeQL 3000
65+
armory:
66+
enabled: false
67+
sbom:
68+
enabled: false
69+
cg:
70+
enabled: true
71+
ignoreDirectories: 'docs,shell,tools'
72+
tsa:
73+
enabled: true # onebranch publish all SDL results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
74+
credscan:
75+
enabled: true
76+
scanFolder: $(Build.SourcesDirectory)
77+
binskim:
78+
break: true # always break the build on binskim issues in addition to TSA upload
79+
policheck:
80+
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
81+
# APIScan requires a non-Ready-To-Run build
82+
apiscan:
83+
enabled: true
84+
softwareName: 'AIShell' # Default is repo name
85+
versionNumber: '1.0' # Default is build number
86+
isLargeApp: false # Default: false.
87+
symbolsFolder: $(SymbolsServerUrl);$(ob_outputDirectory)
88+
tsaOptionsFile: .config\tsaoptions.json
89+
psscriptanalyzer:
90+
enabled: true
91+
policyName: Microsoft
92+
break: false
93+
94+
stages:
95+
- stage: APIScan
96+
displayName: 'ApiScan'
97+
dependsOn: []
98+
jobs:
99+
- template: /.pipelines/templates/compliance/apiscan-build.yaml@self
100+
parameters:
101+
parentJobs: []

.pipelines/Build-Official.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variables:
2828
- name: BUILDSECMON_OPT_IN
2929
value: true
3030
- name: LinuxContainerImage
31-
value: mcr.microsoft.com/onebranch/cbl-mariner/build:2.0
31+
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0
3232
- name: WindowsContainerImage
3333
value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
3434
- name: CDP_DEFINITION_BUILD_COUNT
@@ -68,7 +68,8 @@ extends:
6868
enabled: true
6969
scanFolder: $(Build.SourcesDirectory)
7070
binskim:
71-
enabled: false
71+
enabled: true
72+
exactToolVersion: 4.4.2
7273
apiscan:
7374
enabled: false
7475
tsaOptionsFile: .config\tsaoptions.json

.pipelines/Package-Official.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ variables:
1818
- name: WindowsContainerImage
1919
value: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest' # Docker image which is used to build the project
2020
- name: LinuxContainerImage
21-
value: mcr.microsoft.com/onebranch/cbl-mariner/build:2.0
21+
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0
2222
- group: mscodehub-feed-read-general
2323
- group: mscodehub-feed-read-akv
2424
- name: branchCounterKey
@@ -71,7 +71,8 @@ extends:
7171
enabled: true
7272
scanFolder: $(Build.SourcesDirectory)
7373
binskim:
74-
enabled: false
74+
enabled: true
75+
exactToolVersion: 4.4.2
7576
apiscan:
7677
enabled: false
7778
tsaOptionsFile: .config\tsaoptions.json

.pipelines/Release-Official.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ variables:
2020
- name: WindowsContainerImage
2121
value: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
2222
- name: LinuxContainerImage
23-
value: mcr.microsoft.com/onebranch/cbl-mariner/build:2.0
23+
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0
2424

2525
resources:
2626
repositories:
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
jobs:
5+
- job: APIScan
6+
displayName: APIScan with fxdependent build
7+
condition: succeeded()
8+
pool:
9+
type: windows
10+
variables:
11+
- name: runCodesignValidationInjection
12+
value : false
13+
- name: NugetSecurityAnalysisWarningLevel
14+
value: none
15+
# Defines the variables APIScanClient, APIScanTenant and APIScanSecret
16+
- group: PS-PS-APIScan
17+
- group: 'Azure Blob variable group'
18+
- group: mscodehub-feed-read-general
19+
- group: mscodehub-feed-read-akv
20+
- name: ob_outputDirectory
21+
value: '$(Build.ArtifactStagingDirectory)\ONEBRANCH_ARTIFACT'
22+
- name: repoRoot
23+
value: $(Build.SourcesDirectory)\AIShell
24+
- name: ob_sdl_tsa_configFile
25+
value: $(repoRoot)\.config\tsaoptions.json
26+
- name: Codeql.SourceRoot
27+
value: $(repoRoot)
28+
29+
# APIScan can take a long time
30+
timeoutInMinutes: 180
31+
32+
steps:
33+
- checkout: self
34+
clean: true
35+
fetchTags: true
36+
fetchDepth: 1000
37+
displayName: Checkout AIShell
38+
retryCountOnTaskFailure: 1
39+
env:
40+
ob_restore_phase: true # This ensures checkout is done at the beginning of the restore phase
41+
42+
- template: ..\update-nuget-config.yml@self
43+
parameters:
44+
repoRoot: $(repoRoot)
45+
46+
- task: UseDotNet@2
47+
displayName: 'Use .NET Core sdk'
48+
inputs:
49+
useGlobalJson: true
50+
packageType: 'sdk'
51+
workingDirectory: $(Build.SourcesDirectory)"
52+
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
60+
61+
- task: AzurePowerShell@5
62+
displayName: Download winverify-private Artifacts
63+
inputs:
64+
azureSubscription: az-blob-cicd-infra
65+
scriptType: inlineScript
66+
azurePowerShellVersion: LatestVersion
67+
workingDirectory: '$(repoRoot)'
68+
pwsh: true
69+
inline: |
70+
# download smybols for getfilesiginforedist.dll
71+
$storageAccountName = "pscoretestdata"
72+
$containerName = 'winverify-private'
73+
$winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)\winverify-symbols' -Force
74+
$dllName = 'getfilesiginforedist.dll'
75+
$winverifySymbolsDllPath = Join-Path $winverifySymbolsPath $dllName
76+
77+
$context = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount
78+
Get-AzStorageBlobContent -Container $containerName -Blob $dllName -Destination $winverifySymbolsDllPath -Context $context
79+
80+
- pwsh: |
81+
Get-ChildItem -Path '$(System.ArtifactsDirectory)\winverify-symbols'
82+
displayName: Capture winverify-private Artifacts
83+
workingDirectory: '$(repoRoot)'
84+
condition: succeededOrFailed()
85+
86+
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
87+
displayName: 🔏 CodeQL 3000 Init
88+
condition: eq(variables['CODEQL_ENABLED'], 'true')
89+
inputs:
90+
Language: csharp
91+
92+
- pwsh: |
93+
Import-Module '$(repoRoot)\build.psm1' -Force
94+
Start-Build -Configuration StaticAnalysis -Runtime fxdependent -Clean -Verbose
95+
96+
$outputJson = '$(repoRoot)\_build_output_.json'
97+
if (-not (Test-Path $outputJson)) {
98+
throw "'_build_output_.json' was not produced."
99+
}
100+
101+
$result = Get-Content $outputJson | ConvertFrom-Json
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+
}
109+
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
115+
}
116+
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"
136+
workingDirectory: '$(repoRoot)'
137+
displayName: 'Build AIShell Source'
138+
139+
- pwsh: |
140+
$Destination = '$(ob_outputDirectory)'
141+
if (-not (Test-Path $Destination)) {
142+
Write-Verbose -Verbose -Message "Creating destination folder '$Destination'"
143+
$null = mkdir $Destination
144+
}
145+
146+
Write-Verbose -Verbose -Message "Copy AIShell app to '$Destination':"
147+
Copy-Item -Path '$(appPath)\*' -Destination $Destination -Recurse -Verbose
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
155+
workingDirectory: '$(repoRoot)'
156+
displayName: 'Copy AIShell to ob_outputDirectory'
157+
158+
- task: CodeQL3000Finalize@0 # Add CodeQL Finalize task right after your 'Build' step.
159+
displayName: 🔏 CodeQL 3000 Finalize
160+
condition: eq(variables['CODEQL_ENABLED'], 'true')
161+
162+
- pwsh: |
163+
Get-ChildItem -Path env: | Out-String -width 150 -Stream | write-Verbose -Verbose
164+
workingDirectory: '$(repoRoot)'
165+
displayName: Capture Environment
166+
condition: succeededOrFailed()
167+
168+
# Explicitly download symbols for the drop since the SDL image doesn't have http://SymWeb access and APIScan cannot handle https yet.
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)'
180+
181+
- pwsh: |
182+
Get-ChildItem '$(ob_outputDirectory)' -File -Recurse |
183+
Foreach-Object {
184+
[pscustomobject]@{
185+
Path = $_.FullName
186+
Version = $_.VersionInfo.FileVersion
187+
Md5Hash = (Get-FileHash -Algorithm MD5 -Path $_.FullName).Hash
188+
Sha512Hash = (Get-FileHash -Algorithm SHA512 -Path $_.FullName).Hash
189+
}
190+
} | Export-Csv -Path '$(Build.SourcesDirectory)\ReleaseFileHash.csv'
191+
workingDirectory: '$(repoRoot)'
192+
displayName: 'Create release file hash artifact'
193+
194+
- pwsh: |
195+
Copy-Item -Path '$(Build.SourcesDirectory)\ReleaseFileHash.csv' -Destination '$(ob_outputDirectory)' -Verbose
196+
displayName: 'Publish Build File Hash artifact'

.pipelines/templates/linux-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
value: false
2222
- name: ob_sdl_codeSignValidation_enabled
2323
value: false
24-
- name: ob_sdl_binskim_enabled
25-
value: true
2624
- name: ob_sdl_tsa_configFile
2725
value: $(repoRoot)\.config\tsaoptions.json
2826
- name: Architecture

.pipelines/templates/linux-package.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
2727
- name: repoRoot
2828
value: $(Build.SourcesDirectory)/AIShell
29-
- name: ob_sdl_binskim_enabled
30-
value: true
3129
- name: ob_sdl_tsa_configFile
3230
value: $(repoRoot)/.config/tsaoptions.json
3331
- name: Architecture

.pipelines/templates/mac-package.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929
value: false
3030
- name: ob_outputDirectory
3131
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
32-
- name: ob_sdl_binskim_enabled
33-
value: true
3432
- name: repoRoot
3533
value: $(Build.SourcesDirectory)
3634
- name: Architecture

0 commit comments

Comments
 (0)