From e3ca75768131c6678003ba6ae93a211b2fe94551 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 07:34:00 -0800 Subject: [PATCH 1/6] Fix the log contention in correctness legs The PS1 scripts are not using `ExitWithExitCode` thus they are not properly killing the compiler server and msbuild hence the logs are unreadable. --- azure-pipelines.yml | 7 +++++-- eng/generate-compiler-code.ps1 | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dcb2a8a600e59..06ff9fbb1ba33 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -383,19 +383,22 @@ stages: - task: PowerShell@2 displayName: Restore inputs: + pwsh: true filePath: eng/build.ps1 arguments: -configuration Release -prepareMachine -ci -restore -binaryLogName Restore.binlog - task: PowerShell@2 displayName: Build inputs: + pwsh: true filePath: eng/build.ps1 arguments: -configuration Release -prepareMachine -ci -build -pack -publish -sign -binaryLogName Build.binlog - script: $(Build.SourcesDirectory)\artifacts\bin\BuildBoss\Release\net472\BuildBoss.exe -r "$(Build.SourcesDirectory)/" -c Release -p Roslyn.sln displayName: Validate Build Artifacts - - script: eng/validate-rules-missing-documentation.cmd -ci + - pwsh: | + ./eng/validate-rules-missing-documentation.ps1 -ci displayName: Validate rules missing documentation - pwsh: | @@ -404,7 +407,7 @@ stages: condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['compilerChange'], 'true')) - pwsh: | - ./eng/validate-code-formatting.ps1 -rootDirectory $(Build.SourcesDirectory)\src -includeDirectories Compilers\CSharp\Portable\Generated\, Compilers\VisualBasic\Portable\Generated\, ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\ + ./eng/validate-code-formatting.ps1 -ci -rootDirectory $(Build.SourcesDirectory)\src -includeDirectories Compilers\CSharp\Portable\Generated\, Compilers\VisualBasic\Portable\Generated\, ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\ displayName: Validate Generated Syntax Files condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['compilerChange'], 'true')) diff --git a/eng/generate-compiler-code.ps1 b/eng/generate-compiler-code.ps1 index 8d8bb403d96eb..1d1ed01fe16c8 100644 --- a/eng/generate-compiler-code.ps1 +++ b/eng/generate-compiler-code.ps1 @@ -3,7 +3,8 @@ # the generator source files. [CmdletBinding(PositionalBinding=$false)] param ([string]$configuration = "Debug", - [switch]$test = $false) + [switch]$test = $false, + [bool]$ci = $false) Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" @@ -136,11 +137,11 @@ try { Run-IOperation $coreDir $operationsProject Run-GetText - exit 0 + ExitWithExitCode 0 } catch { Write-Host $_ - exit 1 + ExitWithExitCode 1 } finally { Pop-Location From a7c09d562abfa6150dac100933346af246cdca0d Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 08:28:20 -0800 Subject: [PATCH 2/6] more --- eng/pipelines/build-bootstrap.yml | 6 ++++-- eng/test-build-correctness.ps1 | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/build-bootstrap.yml b/eng/pipelines/build-bootstrap.yml index bb3678676d99c..78bfc82ae7f97 100644 --- a/eng/pipelines/build-bootstrap.yml +++ b/eng/pipelines/build-bootstrap.yml @@ -7,10 +7,12 @@ parameters: steps: - template: checkout-windows-task.yml - - script: eng\make-bootstrap.cmd -ci -toolset ${{parameters.toolset}} -name "ci-bootstrap" + - pwsh: | + ./eng/make-bootstrap.cmd -ci -toolset ${{parameters.toolset}} -name "ci-bootstrap" displayName: Build Bootstrap Compiler - - script: eng/test-build-correctness.cmd -configuration Release -enableDumps -bootstrapDir $(Build.SourcesDirectory)/artifacts/bootstrap/ci-bootstrap + - pwsh: | + ./eng/test-build-correctness.ps1 -ci -configuration Release -enableDumps -bootstrapDir $(Build.SourcesDirectory)/artifacts/bootstrap/ci-bootstrap displayName: Build - Validate correctness - template: publish-logs.yml diff --git a/eng/test-build-correctness.ps1 b/eng/test-build-correctness.ps1 index bec533c086ada..b569d33fb96bc 100644 --- a/eng/test-build-correctness.ps1 +++ b/eng/test-build-correctness.ps1 @@ -65,14 +65,14 @@ try { Exec-DotNet "tool run dotnet-format whitespace . --folder --include-generated --include src/Compilers/CSharp/Portable/Generated/ src/Compilers/VisualBasic/Portable/Generated/ src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Generated/ --verify-no-changes" Write-Host "" - exit 0 + ExitWithExitCode 0 } catch { Write-Host $_ Write-Host $_.Exception Write-Host $_.ScriptStackTrace Write-Host "##vso[task.logissue type=error]How to investigate bootstrap failures: https://github.com/dotnet/roslyn/blob/main/docs/compilers/Bootstrap%20Builds.md#Investigating" - exit 1 + ExitWithExitCode 1 } finally { if ($enableDumps) { From 94bf643aea12554edfaf37358a235a24192c64d8 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 08:31:41 -0800 Subject: [PATCH 3/6] more --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 06ff9fbb1ba33..75a58f9755019 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -398,7 +398,7 @@ stages: displayName: Validate Build Artifacts - pwsh: | - ./eng/validate-rules-missing-documentation.ps1 -ci + ./eng/validate-rules-missing-documentation.ps1 -ci displayName: Validate rules missing documentation - pwsh: | From 49d0508dd41c32fdf5a20effce3767c0bae7c7b6 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 09:33:00 -0800 Subject: [PATCH 4/6] more --- eng/generate-compiler-code.ps1 | 1 + eng/test-build-correctness.ps1 | 1 + eng/validate-code-formatting.ps1 | 8 +++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/eng/generate-compiler-code.ps1 b/eng/generate-compiler-code.ps1 index 1d1ed01fe16c8..448735e2f433b 100644 --- a/eng/generate-compiler-code.ps1 +++ b/eng/generate-compiler-code.ps1 @@ -116,6 +116,7 @@ function Get-ToolPath($projectRelativePath) { try { . (Join-Path $PSScriptRoot "build-utils.ps1") Push-Location $RepoRoot + $prepareMachine = $ci $dotnet = Ensure-DotnetSdk $boundTreeGenProject = Get-ToolPath 'BoundTreeGenerator\CompilersBoundTreeGenerator.csproj' diff --git a/eng/test-build-correctness.ps1 b/eng/test-build-correctness.ps1 index b569d33fb96bc..2cc217435a29a 100644 --- a/eng/test-build-correctness.ps1 +++ b/eng/test-build-correctness.ps1 @@ -33,6 +33,7 @@ try { . (Join-Path $PSScriptRoot "build-utils.ps1") Push-Location $RepoRoot + $prepareMachine = $ci if ($enableDumps) { $key = "HKLM:\\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" diff --git a/eng/validate-code-formatting.ps1 b/eng/validate-code-formatting.ps1 index 89ef02ba22a86..bb7dc8df7e9c1 100644 --- a/eng/validate-code-formatting.ps1 +++ b/eng/validate-code-formatting.ps1 @@ -1,6 +1,8 @@ param ( [string]$rootDirectory, - [string[]]$includeDirectories + [string[]]$includeDirectories, + [bool]$ci = $false, + [bool]$prepareMachine = $false ) Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" @@ -11,11 +13,11 @@ try { Exec-DotNet "tool run dotnet-format -v detailed whitespace $rootDirectory --folder --include-generated --include $includeDirectories --verify-no-changes" - exit 0 + ExitWithExitCode 0 } catch { Write-Host $_ - exit 1 + ExitWithExitCode 1 } finally { Pop-Location From 7e67f840968c47a7454a156d35ae2064494dbe7e Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 09:35:32 -0800 Subject: [PATCH 5/6] more --- eng/validate-code-formatting.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/validate-code-formatting.ps1 b/eng/validate-code-formatting.ps1 index bb7dc8df7e9c1..340a780073622 100644 --- a/eng/validate-code-formatting.ps1 +++ b/eng/validate-code-formatting.ps1 @@ -1,8 +1,7 @@ param ( [string]$rootDirectory, [string[]]$includeDirectories, - [bool]$ci = $false, - [bool]$prepareMachine = $false + [bool]$ci = $false ) Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" @@ -10,6 +9,7 @@ $ErrorActionPreference="Stop" try { . (Join-Path $PSScriptRoot "build-utils.ps1") Push-Location $RepoRoot + $prepareMachine = $ci Exec-DotNet "tool run dotnet-format -v detailed whitespace $rootDirectory --folder --include-generated --include $includeDirectories --verify-no-changes" From e46b74fd0ebf9ca267997e072b43edb7bcdaa192 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Sat, 24 Feb 2024 10:26:59 -0800 Subject: [PATCH 6/6] more --- eng/generate-compiler-code.ps1 | 2 +- eng/validate-code-formatting.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/generate-compiler-code.ps1 b/eng/generate-compiler-code.ps1 index 448735e2f433b..3e323530f30c3 100644 --- a/eng/generate-compiler-code.ps1 +++ b/eng/generate-compiler-code.ps1 @@ -4,7 +4,7 @@ [CmdletBinding(PositionalBinding=$false)] param ([string]$configuration = "Debug", [switch]$test = $false, - [bool]$ci = $false) + [switch]$ci = $false) Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" diff --git a/eng/validate-code-formatting.ps1 b/eng/validate-code-formatting.ps1 index 340a780073622..fcfc7327dbcba 100644 --- a/eng/validate-code-formatting.ps1 +++ b/eng/validate-code-formatting.ps1 @@ -1,7 +1,7 @@ param ( [string]$rootDirectory, [string[]]$includeDirectories, - [bool]$ci = $false + [switch]$ci = $false ) Set-StrictMode -version 2.0 $ErrorActionPreference="Stop"