Repository navigation
ci: stop WSL before exporting the prepared WSL distribution - #346355
Merged
Ladislau Szomoru (lszomoru) merged 2 commits intoNov 5, 2026
Merged
Ladislau Szomoru (lszomoru) merged 2 commits into
Ladislau Szomoru (lszomoru) merged 2 commits into
Conversation
The first run of the wsl-distro job of pr-workspace-images.yml failed to export the distribution: `wsl --export --format vhd` reports a sharing violation while the utility VM still holds the VHD of the distribution, which `wsl --terminate` doesn't release (microsoft/WSL#10737). Prepare runs in a job of its own, so it now stops the VM with `wsl --shutdown` before the export. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ladislau Szomoru (lszomoru)
marked this pull request as ready for review
November 5, 2026 19:53
Ladislau Szomoru (lszomoru)
enabled auto-merge (squash)
November 5, 2026 19:53
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
PR checks do not exercise Prepare, so a manually dispatched wsl-distro job must confirm that Windows/WSL releases the VHD on the 1ES runner and that export and caching succeed.
No open issues 🎉
What changed in this PR
This follow-up to #346338 addresses the sharing violation when exporting the prepared WSL distribution used by Windows smoke tests.
Changes:
- Replace distribution-only termination with
wsl --shutdownto release the VHD before export, with updated error handling and an explanatory comment. - Rename the preparation job to
Windows (WSL distro).
No actionable findings remain. End-to-end export validation still requires a manual workflow run because pull request checks do not run this job.
| File | Description |
|---|---|
test/smoke/wslDevContainer.ps1 |
Shut down WSL before exporting the prepared distribution’s VHD. |
.github/workflows/pr-workspace-images.yml |
Rename the WSL preparation job’s display label. |
Review effort: Balanced
roblourens
approved these changes
Nov 5, 2026
Ladislau Szomoru (lszomoru)
deleted the
lszomoru/agents/wsl-distro-export-shutdown
branch
November 5, 2026 20:06
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.
Follow-up to #346338. The first run of its
wsl-distrojob (run 42096277037) prepared the distribution, then failed to export it:Export-PreparedDistributionintest/smoke/wslDevContainer.ps1stopped the distribution withwsl --terminatebeforewsl --export --format vhd, but the utility VM keeps holding the VHD of the distribution after--terminate; onlywsl --shutdownreliably releases it (microsoft/WSL#10737, microsoft/WSL#12434). ThePrepareoperation runs in a job of its own on a dedicated machine, so it now stops the VM withwsl --shutdownbefore the export. The only step after the export, which unregisters the distribution, doesn't need a running VM.Also renames the job to
Windows (WSL distro).Until a run exports the distribution, the WSL smoke shard finds no prepared distribution and builds it as before.
How to test
The
wsl-distrojob only runs on schedule and manual dispatch, so the checks of this pull request don't run it. Dispatchpr-workspace-images.ymlon this branch (gh workflow run pr-workspace-images.yml --ref lszomoru/agents/wsl-distro-export-shutdown) and check thatWindows (WSL distro)exports and saves the distribution. After merging, dispatch it onmainonce: the cache key hasheswslDevContainer.ps1, so the WSL smoke shard only finds a distribution exported by a run with this change.Validation:
pwsh[System.Management.Automation.Language.Parser]::ParseFileontest/smoke/wslDevContainer.ps1: no errorsgo run github.com/rhysd/actionlint/cmd/actionlint@latest -shellcheck= .github/workflows/pr-workspace-images.yml: only unknown custom runner labelscd build && node --test lib/test/detectMissingCaches.test.ts lib/test/detectChanges.test.ts: 22 passed