Skip to content

Commit cfc0bcd

Browse files
authored
Fix the APIScan pipeline (#26016)
1. When removing unused runtimes, keep the `win` and `win-x64` runtime folders. 2. Stop downloading `getfilesiginforedist.dll` from Azure blob. The original `getfilesiginforedist.dll` produced from the build works fine with the symbols retrieved by `dotnet-symbols`.
1 parent a1b4176 commit cfc0bcd

File tree

2 files changed

+21
-38
lines changed

2 files changed

+21
-38
lines changed

.pipelines/apiscan-gen-notice.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ extends:
8383
break: true # always break the build on binskim issues in addition to TSA upload
8484
policheck:
8585
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
86-
# APIScan requires a non-Ready-To-Run build
86+
# APIScan requires a non-Ready-To-Run build
8787
apiscan:
8888
enabled: true
8989
softwareName: "PowerShell" # Default is repo name
90-
versionNumber: "7.5" # Default is build number
90+
versionNumber: "7.6" # Default is build number
9191
isLargeApp: false # Default: false.
9292
symbolsFolder: $(SymbolsServerUrl);$(ob_outputDirectory)
9393
#softwareFolder - relative path to a folder to be scanned. Default value is root of artifacts folder

.pipelines/templates/compliance/apiscan.yml

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
- name: branchCounter
1818
value: $[counter(variables['branchCounterKey'], 1)]
1919
- group: DotNetPrivateBuildAccess
20-
- group: Azure Blob variable group
2120
- group: ReleasePipelineSecrets
2221
- group: mscodehub-feed-read-general
2322
- group: mscodehub-feed-read-akv
@@ -75,34 +74,6 @@ jobs:
7574
workingDirectory: '$(repoRoot)'
7675
retryCountOnTaskFailure: 2
7776
78-
- task: AzurePowerShell@5
79-
displayName: Download winverify-private Artifacts
80-
inputs:
81-
azureSubscription: az-blob-cicd-infra
82-
scriptType: inlineScript
83-
azurePowerShellVersion: LatestVersion
84-
workingDirectory: '$(repoRoot)'
85-
pwsh: true
86-
inline: |
87-
# download smybols for getfilesiginforedist.dll
88-
$downloadsDirectory = '$(Build.ArtifactStagingDirectory)/downloads'
89-
$uploadedDirectory = '$(Build.ArtifactStagingDirectory)/uploaded'
90-
$storageAccountName = "pscoretestdata"
91-
$containerName = 'winverify-private'
92-
$winverifySymbolsPath = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/winverify-symbols' -Force
93-
$dllName = 'getfilesiginforedist.dll'
94-
$winverifySymbolsDllPath = Join-Path $winverifySymbolsPath $dllName
95-
96-
$context = New-AzStorageContext -StorageAccountName $storageAccountName -UseConnectedAccount
97-
98-
Get-AzStorageBlobContent -Container $containerName -Blob $dllName -Destination $winverifySymbolsDllPath -Context $context
99-
100-
- pwsh: |
101-
Get-ChildItem -Path '$(System.ArtifactsDirectory)/winverify-symbols'
102-
displayName: Capture winverify-private Artifacts
103-
workingDirectory: '$(repoRoot)'
104-
condition: succeededOrFailed()
105-
10677
- task: CodeQL3000Init@0 # Add CodeQL Init task right before your 'Build' step.
10778
displayName: 🔏 CodeQL 3000 Init
10879
condition: eq(variables['CODEQL_ENABLED'], 'true')
@@ -121,23 +92,35 @@ jobs:
12192
Remove-Item -Recurse -Force $OutputFolder/ref
12293
}
12394
124-
Copy-Item -Path "$OutputFolder\*" -Destination '$(ob_outputDirectory)' -Recurse -Verbose
95+
$Destination = '$(ob_outputDirectory)'
96+
if (-not (Test-Path $Destination)) {
97+
Write-Verbose -Verbose -Message "Creating destination folder '$Destination'"
98+
$null = mkdir $Destination
99+
}
100+
101+
Copy-Item -Path "$OutputFolder\*" -Destination $Destination -Recurse -Verbose
125102
workingDirectory: '$(repoRoot)'
126103
displayName: 'Build PowerShell Source'
127104
128105
- pwsh: |
129-
# Only key windows runtimes
130-
Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' -File -Recurse | Where-Object {$_.FullName -notmatch '.*\/runtimes\/win'} | Foreach-Object {
106+
# Only keep windows runtimes
107+
Write-Verbose -Verbose -Message "Deleting non-win-x64 runtimes ..."
108+
Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' | Where-Object {$_.FullName -notmatch '.*\\runtimes\\win'} | Foreach-Object {
131109
Write-Verbose -Verbose -Message "Deleting $($_.FullName)"
132-
Remove-Item -Force -Verbose -Path $_.FullName
110+
Remove-Item -Path $_.FullName -Recurse -Force
133111
}
134112
135-
# Temporarily remove runtimes/win-x64 due to issues with that runtime
136-
Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' -File -Recurse | Where-Object {$_.FullName -match '.*\/runtimes\/win-x86\/'} | Foreach-Object {
113+
# Remove win-x86/arm/arm64 runtimes due to issues with those runtimes
114+
Write-Verbose -Verbose -Message "Temporarily deleting win-x86/arm/arm64 runtimes ..."
115+
Get-ChildItem -Path '$(ob_outputDirectory)\runtimes\*' | Where-Object {$_.FullName -match '.*\\runtimes\\win-(x86|arm)'} | Foreach-Object {
137116
Write-Verbose -Verbose -Message "Deleting $($_.FullName)"
138-
Remove-Item -Force -Verbose -Path $_.FullName
117+
Remove-Item -Path $_.FullName -Recurse -Force
139118
}
140119
120+
Write-Host
121+
Write-Verbose -Verbose -Message "Show content in 'runtimes' folder:"
122+
Get-ChildItem -Path '$(ob_outputDirectory)\runtimes'
123+
Write-Host
141124
workingDirectory: '$(repoRoot)'
142125
displayName: 'Remove unused runtimes'
143126

0 commit comments

Comments
 (0)