[ci]Fail when a step in multiline powershell fails (#35520)

This commit is contained in:
Jaime Bernardo 2024-10-23 08:52:47 +01:00 committed by GitHub
parent 5af2f6f825
commit 04795c6d3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -143,13 +143,19 @@ jobs:
- pwsh: |-
& '.pipelines/applyXamlStyling.ps1' -Passive
displayName: Verify XAML formatting
- pwsh: |-
& '.pipelines/verifyNugetPackages.ps1' -solution '$(build.sourcesdirectory)\PowerToys.sln'
displayName: Verify Nuget package versions for PowerToys.sln
- pwsh: |-
& '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\PowerToys.sln'
& '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln'
& '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln'
& '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln'
& '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln'
displayName: Verify formatting, nuget, and ARM64 configurations
displayName: Verify ARM64 configurations
- ${{ if eq(parameters.enablePackageCaching, true) }}:
- task: Cache@2

View File

@ -59,6 +59,7 @@ if ($errorTable.Count -gt 0) {
};
Write-Host -ForegroundColor Red `r
}
Write-Error "Found arm64 verification errors."
exit 1;
}

View File

@ -48,7 +48,7 @@ $totalFailure = 0;
Write-Host $DirPath;
if (-not (Test-Path $DirPath)) {
Write-Host "Folder does not exist!"
Write-Error "Folder does not exist!"
}
Write-Host "Total items: " $items.Count
@ -79,6 +79,7 @@ $items | ForEach-Object {
}
if ($totalFailure -gt 0) {
Write-Error "Some items had issues."
exit 1
}