Repository navigation
ci: import a daily prepared WSL distribution in the Windows WSL smoke shard - #346338
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The new WSL export/import path lacks end-to-end Windows validation, leaving Server 2022 compatibility, complete artifact retrieval, smoke coverage, and failure recovery unverified.
No open issues 🎉
What changed in this PR
This PR reduces repeated WSL provisioning in Windows smoke tests by preparing a reusable distribution alongside the workspace image. The smoke shard imports it when its inputs match, with a fallback to building the distribution from scratch.
Changes:
- Adds WSL distribution preparation, VHD export/import, and fallback handling.
- Adds input-validated artifact fetching and integrates it into background smoke-test setup.
- Updates workflow consistency tests and documentation.
Windows preparation, import, and fallback behavior remain unvalidated on Windows, as noted in the PR.
| File | Description |
|---|---|
test/smoke/wslDevContainer.ps1 |
Adds preparation, export, import, and fallback operations. |
test/smoke/README.md |
Documents prepared distributions and fallback behavior. |
build/lib/test/workspaceImage.test.ts |
Checks artifact naming and input-trigger consistency. |
.github/workflows/workspace_image/README.md |
Documents WSL artifact production and consumption. |
.github/workflows/workspace_image/image.ts |
Adds deadline-bound fetching with input validation. |
.github/workflows/pr.yml |
Grants Windows jobs artifact-read permission. |
.github/workflows/pr-workspace-images.yml |
Prepares, packs, and uploads the WSL distribution. |
.github/workflows/pr-win32-test.yml |
Fetches the distribution during background WSL setup. |
.github/skills/smoke-tests/SKILL.md |
Documents prepared WSL distribution handling. |
Review effort: Balanced
… shard The Windows smoke test shard with the WSL suite built its WSL distribution from scratch in every run: the Ubuntu rootfs, the pinned Linux server, the apt packages and the dev container image. wslDevContainer.ps1 gets a Prepare operation that builds the same distribution, stops Docker Engine, trims it and exports its VHD with `wsl --export --format vhd`. A new Windows (WSL distribution) job of pr-workspace-images.yml runs it on the 1ES pool on the daily schedule and on manual runs, and saves the VHD with actions/cache under a key that hashes wslDevContainer.ps1 and build/checksums/wsl.txt. The shard restores the newest entry for its hash, and Setup registers the VHD under the run's distribution name with `wsl --import-in-place`, starts Docker Engine and checks the container and bind mount. Without a prepared distribution, or when importing or starting it fails, Setup builds the distribution as before. Its outputs, AddServer, Cleanup and the Azure Pipelines use are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1a7a38c to
a7590ca
Compare
|
Ladislau Szomoru (@lszomoru) FYI: since the first daily prepared distribution came in at about 20:40 UTC, I think the problem is Docker's persisted bridge network colliding with WSL's NAT subnet:
Two possible fixes:
Either option needs a new prepared VHD. I'm happy to send a draft for either one. Which do you prefer?
|
|
Ladislau Szomoru (@lszomoru) I've drafted the fix for this as #346615. Before starting dockerd,
|
dockerd stores the subnet of its default bridge under /var/lib/docker/network. The prepared WSL distribution (#346338) brings the subnet chosen on the machine that prepared it, 172.17.0.0/16, and when WSL puts this machine's NAT network inside it (172.17.16.0/20, 172.17.112.0/20), containers cannot reach the resolver: the dev container's postCreateCommand fails with 'Could not resolve host' and the WSL Dev Container smoke test times out. Remove the stored network before starting dockerd, so it picks a subnet that does not overlap this machine's routes, and log both subnets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dockerd stores the subnet of its default bridge under /var/lib/docker/network. The prepared WSL distribution (#346338) brings the subnet chosen on the machine that prepared it, 172.17.0.0/16, and when WSL puts this machine's NAT network inside it (172.17.16.0/20, 172.17.112.0/20), containers cannot reach the resolver: the dev container's postCreateCommand fails with 'Could not resolve host' and the WSL Dev Container smoke test times out. Remove the stored network before starting dockerd, so it picks a subnet that does not overlap this machine's routes, and log both subnets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion (#346615) dockerd stores the subnet of its default bridge under /var/lib/docker/network. The prepared WSL distribution (#346338) brings the subnet chosen on the machine that prepared it, 172.17.0.0/16, and when WSL puts this machine's NAT network inside it (172.17.16.0/20, 172.17.112.0/20), containers cannot reach the resolver: the dev container's postCreateCommand fails with 'Could not resolve host' and the WSL Dev Container smoke test times out. Remove the stored network before starting dockerd, so it picks a subnet that does not overlap this machine's routes, and log both subnets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Windows smoke test shard with the WSL suite (
Electron-Smoke (shard 1/3), 1ES pool) builds its WSL distribution from scratch in every run: it downloads the Ubuntu rootfs and the pinned Linux server, downloads and installs the apt packages (docker.io, krb5, squid-openssl, …) and pulls the dev container image. This prepares that distribution once a day and the shard imports it instead.What changed
test/smoke/wslDevContainer.ps1stays one script. Its build steps move into functions without changing their commands, and it gets aPrepareoperation that builds the same distribution up to the pulled dev container image, stops dockerd, cleans and trims the disk, and exports the VHD withwsl --export --format vhd(thendiskpart compact vdisk, best effort).Setupimports the VHD named byWSL_PREPARED_DISTRO_VHDwithwsl --import-in-placeunder the run's distribution name, starts dockerd and runs the existing image, bind mount and non-root Docker checks. Without one, or when importing or starting it fails, it unregisters it and builds the distribution as before. The outputs,AddServer,Cleanupand Azure Pipelines are unchanged.pr-workspace-images.yml: a newWindows (WSL distribution)job, which only runs on the daily schedule and on manual runs. It runs on the 1ES pool like the shard, as GitHub-hosted Windows runners intermittently freeze while WSL2 provisions a distribution (Windows hosted runner worker freezes during WSL2 provisioning; step timeouts never fire, job runs to the job cap with no logs actions/runner-images#14938). It runsPrepareand saves the VHD withactions/cache/saveunderwsl-distro-v1-Windows-<hash of wslDevContainer.ps1 and build/checksums/wsl.txt>-<run id>-<attempt>. The image jobs are unchanged.pr-win32-test.yml: shard 1 restores the newest entry with that hash (restore-keys,continue-on-error) before it starts the background WSL setup (Optimize VS Code PR checks by skipping unnecessary tests and updating shards #346272), and passes the VHD inWSL_PREPARED_DISTRO_VHD.Things to look at
wslDevContainer.ps1orbuild/checksums/wsl.txthas another hash, so its shard builds the distribution until the next daily run, or a manual run onmain, prepares one. That includes this pull request.actions: write) if that is too much.How to test
Code OSS (workspace images)manually onmain: theWindows (WSL distribution)job logs the export size and saves the cache. In the next pull requests that don't change the two files, shard 1 restores it, its setup log saysimported the prepared distribution, and the WSL suite, the Kerberos proxy run and the cleanup pass.Validation:
cd build && node --test lib/test/detectMissingCaches.test.ts lib/test/detectChanges.test.ts lib/test/workspaceImage.test.ts: 23 passedgo run github.com/rhysd/actionlint/cmd/actionlint@latest -shellcheck= .github/workflows/pr-workspace-images.yml .github/workflows/pr-win32-test.yml: only unknown custom runner labelspwshparse ofwslDevContainer.ps1and of the setup script inpr-win32-test.yml: no errorsPrepare,wsl --import-in-place, the fallback)