[devops] Fix API scan when there are no enabled .NET platforms. (#20477)

This commit is contained in:
Rolf Bjarne Kvinge 2024-04-29 16:31:29 +02:00 коммит произвёл GitHub
Родитель 16d9ece88e
Коммит 526fdc9437
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -10,6 +10,10 @@ class APIScanConfiguration {
$vars = [ordered]@{}
Write-Host "enabledPlatforms: $($this.enabledPlatforms)"
if ($this.enabledPlatforms.count -eq 0) {
return ""
}
foreach ($platform in $this.enabledPlatforms) {
# each platform has its version in an environment variable, we need to get it, this
# could have been inlined when assigning the dictionary but we want to be cleaner.

Просмотреть файл

@ -88,8 +88,10 @@ steps:
gci env: | sort | format-table -autosize -wrap
$apiScanMatrix = Get-APIScanConfiguration -EnabledPlatforms "$Env:CONFIGURE_PLATFORMS_DOTNET_PLATFORMS"
# compress the json to remove any newlines, because we can't set the variable below if the json has any newlines
Write-Host "$apiScanMatrix"
$apiScanMatrix = $apiScanMatrix | ConvertFrom-Json | ConvertTo-Json -Compress
Write-Host "apiScanMatrix=$apiScanMatrix"
if ($apiScanMatrix.length -gt 0) {
$apiScanMatrix = $apiScanMatrix | ConvertFrom-Json | ConvertTo-Json -Compress
}
Write-Host "##vso[task.setvariable variable=APISCAN_MATRIX;isOutput=true]$apiScanMatrix"
name: apiscan_matrix
displayName: 'Create APIScan matrix'

Просмотреть файл

@ -31,6 +31,7 @@ stages:
demands:
- ImageOverride -equals 1ESPT-Windows2022
condition: ne(stageDependencies.configure_build.configure.outputs['apiscan_matrix.APISCAN_MATRIX'],'')
strategy:
matrix: $[ stageDependencies.configure_build.configure.outputs['apiscan_matrix.APISCAN_MATRIX'] ]