[devops] Fix API scan when there are no enabled .NET platforms. (#20477)
This commit is contained in:
Родитель
16d9ece88e
Коммит
526fdc9437
|
@ -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'] ]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче