CI: Disable powershell engine event logging before running tests#3457
Open
smalis-msft wants to merge 1 commit into
Open
CI: Disable powershell engine event logging before running tests#3457smalis-msft wants to merge 1 commit into
smalis-msft wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a Flowey CI step to disable Windows PowerShell engine event logging on Windows runners to mitigate transient powershell.exe startup crashes that cause test flakiness.
Changes:
- Introduces a new Flowey node to harden PowerShell event logging via registry settings.
- Wires the hardening node into the Windows test job’s pre-run dependencies.
- Adds explicit CI workflow steps to run the hardening node before starting test services.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| flowey/flowey_lib_hvlite/src/lib.rs | Exposes the new hardening module from the crate. |
| flowey/flowey_lib_hvlite/src/harden_powershell_event_log.rs | Implements the Windows runner hardening step (registry + event source check). |
| flowey/flowey_lib_hvlite/src/_jobs/consume_and_test_nextest_vmm_tests_archive.rs | Ensures hardening runs before tests on Windows. |
| ci-flowey/openvmm-pr.yaml | Adds pipeline steps to run the hardening node before starting test services. |
| .github/workflows/openvmm-pr.yaml | Adds GitHub Actions steps to run the hardening node in multiple Windows jobs. |
| .github/workflows/openvmm-pr-release.yaml | Adds the hardening step to Windows release PR workflow jobs. |
| .github/workflows/openvmm-ci.yaml | Adds the hardening step to Windows CI workflow jobs. |
| if (-not (Test-Path $key)) { | ||
| New-Item -Path $key -Force | Out-Null | ||
| } | ||
| Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force |
Comment on lines
+52
to
+81
| // Disable Windows PowerShell engine event logging. The key may | ||
| // not pre-exist on all runner images, so create it first. | ||
| // Failures are logged but non-fatal: the worst case is we fall | ||
| // back to the original (occasionally flaky) behavior. | ||
| let script = r#" | ||
| $ErrorActionPreference = 'Continue' | ||
| $key = 'HKLM:\Software\Microsoft\PowerShell\1\PowerShellEngine' | ||
| if (-not (Test-Path $key)) { | ||
| New-Item -Path $key -Force | Out-Null | ||
| } | ||
| Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force | ||
| # Ensure the 'Windows PowerShell' Event Log source exists with | ||
| # the right registration so any path that still tries to use | ||
| # it doesn't fault. | ||
| try { | ||
| if (-not [System.Diagnostics.EventLog]::SourceExists('PowerShell')) { | ||
| [System.Diagnostics.EventLog]::CreateEventSource('PowerShell','Windows PowerShell') | ||
| } | ||
| } catch { | ||
| Write-Host "warn: could not verify PowerShell event source: $_" | ||
| } | ||
| "#; | ||
|
|
||
| let output = std::process::Command::new("powershell.exe") | ||
| .arg("-NoProfile") | ||
| .arg("-NonInteractive") | ||
| .arg("-ExecutionPolicy") | ||
| .arg("Bypass") | ||
| .arg("-Command") | ||
| .arg(script) |
Comment on lines
+62
to
+72
| Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force | ||
| # Ensure the 'Windows PowerShell' Event Log source exists with | ||
| # the right registration so any path that still tries to use | ||
| # it doesn't fault. | ||
| try { | ||
| if (-not [System.Diagnostics.EventLog]::SourceExists('PowerShell')) { | ||
| [System.Diagnostics.EventLog]::CreateEventSource('PowerShell','Windows PowerShell') | ||
| } | ||
| } catch { | ||
| Write-Host "warn: could not verify PowerShell event source: $_" | ||
| } |
| // back to the original (occasionally flaky) behavior. | ||
| let script = r#" | ||
| $ErrorActionPreference = 'Continue' | ||
| $key = 'HKLM:\Software\Microsoft\PowerShell\1\PowerShellEngine' |
| if (-not (Test-Path $key)) { | ||
| New-Item -Path $key -Force | Out-Null | ||
| } | ||
| Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force |
Comment on lines
+3597
to
+3599
| - name: harden Windows PowerShell event log | ||
| run: flowey.exe e 20 flowey_lib_hvlite::harden_powershell_event_log 0 | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've been seeing a lot of test flakiness lately that seems to be coming from powershell itself crashing during startup, not any of our code. Claude seems to think that disabling this bit of powershell internal logging should fix it. Let's see what happens.
Alternative to #3456