From 04795c6d3a4f26c0de4c5fc319fc1c34e79355e1 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Wed, 23 Oct 2024 08:52:47 +0100 Subject: [PATCH] [ci]Fail when a step in multiline powershell fails (#35520) --- .pipelines/v2/templates/job-build-project.yml | 8 +++++++- .pipelines/verifyArm64Configuration.ps1 | 1 + .pipelines/versionAndSignCheck.ps1 | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pipelines/v2/templates/job-build-project.yml b/.pipelines/v2/templates/job-build-project.yml index 565ba3cab7..40a0e4a866 100644 --- a/.pipelines/v2/templates/job-build-project.yml +++ b/.pipelines/v2/templates/job-build-project.yml @@ -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 diff --git a/.pipelines/verifyArm64Configuration.ps1 b/.pipelines/verifyArm64Configuration.ps1 index 3a6a9cfe29..a509ec374f 100644 --- a/.pipelines/verifyArm64Configuration.ps1 +++ b/.pipelines/verifyArm64Configuration.ps1 @@ -59,6 +59,7 @@ if ($errorTable.Count -gt 0) { }; Write-Host -ForegroundColor Red `r } + Write-Error "Found arm64 verification errors." exit 1; } diff --git a/.pipelines/versionAndSignCheck.ps1 b/.pipelines/versionAndSignCheck.ps1 index 1b15fe52db..1baf34570e 100644 --- a/.pipelines/versionAndSignCheck.ps1 +++ b/.pipelines/versionAndSignCheck.ps1 @@ -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 }