Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/skills/smoke-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Some placement is coupled to the workflows, and `test/smoke/src/shard.ts` encode

- **WSL:** The WSL Dev Container suite is pinned to shard 1, and `pr-win32-test.yml` provisions WSL only in shard 1. The provisioning runs in the background while the shard installs and builds, and a step before the smoke tests waits for it. The suite's estimate in `shard.ts` also counts the WSL Kerberos proxy run after the shard, so that the balancer gives shard 1 fewer other suites. Keep `VSCODE_SMOKE_TEST_WSL_REQUIRED` set in every shard, so that all shards register the same suites and compute the same split. On Windows, shard 1 runs on the 1ES pool instead of the `vscode-large-runners-windows-8-core` larger runners: GitHub-hosted Windows runners intermittently freeze while WSL2 provisions a distribution ([actions/runner-images#14938](https://github.com/actions/runner-images/issues/14938)), which leaves the check pending for about 45 minutes until GitHub reports that it lost communication with the runner.
- **WSL version:** the agents' Windows Server 2022 image only has the inbox WSL, so provisioning installs the WSL release pinned in `build/checksums/wsl.txt` (see `build/azure-pipelines/common/wsl.psm1`). To update it, put the SHA256 and file name of a newer `wsl.<version>.x64.msi` from the [microsoft/WSL releases](https://github.com/microsoft/WSL/releases) there. The installer caches key on that file; `pr-node-modules.yml` fills the GitHub cache on `main`.
- **Prepared WSL distribution:** the `wsl-distro` job of `pr-workspace-images.yml` (1ES pool, daily schedule and manual runs only) runs `wslDevContainer.ps1 -Operation Prepare` and saves the exported VHD in a cache keyed on the hash of `wslDevContainer.ps1` and `build/checksums/wsl.txt`. Shard 1 restores the newest entry for its hash and imports it with `wsl --import-in-place` instead of building the distribution. It builds the distribution when there is no entry for its hash (for example after a change to either file, until the next daily run or a manual run of the workflow on `main`), or when the import fails.
- **macOS proxy runs:** On macOS, the PAC proxy Agents Window runs happen only in the last shard, so the balancer reserves their time there.

Every shard must register the same suites; otherwise suites can be skipped or run twice. Don't make suite registration depend on anything that differs between shards.
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/pr-win32-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ jobs:
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == '1' }}
uses: ./.github/actions/restore-wsl-installer

# The wsl-distro job of pr-workspace-images.yml prepares the WSL distribution on main every day, so that the
# setup imports it instead of building it. Its key hashes the files that define it, and the restore key finds the
# newest one. Without one, or when it cannot be used, wslDevContainer.ps1 builds the distribution.
- name: Restore prepared WSL distribution
if: ${{ env.ELECTRON_TESTS == 'true' && env.SMOKE_TESTS == 'true' && env.SMOKE_SHARD_INDEX == '1' }}
continue-on-error: true
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .build/wsl-distro
key: "wsl-distro-v1-${{ runner.os }}-${{ hashFiles('test/smoke/wslDevContainer.ps1', 'build/checksums/wsl.txt') }}"
restore-keys: "wsl-distro-v1-${{ runner.os }}-${{ hashFiles('test/smoke/wslDevContainer.ps1', 'build/checksums/wsl.txt') }}-"

# The WSL setup takes 2 to 4 minutes, mostly downloads and package installs, so it runs in the background
# while the steps below install and build, and "Wait for the WSL Dev Container smoke test setup" waits for
# it before the smoke tests. The setup writes its step outputs, log and exit code to files. Start-Process
Expand Down Expand Up @@ -160,6 +172,7 @@ jobs:
Set-Content -LiteralPath (Join-Path $state 'deadline.txt') -Value ([DateTime]::UtcNow.AddMinutes(15).ToString('o'))
env:
WSL_INSTALLER_CACHE_DIR: ${{ github.workspace }}\.build\wsl-installer
WSL_PREPARED_DISTRO_VHD: ${{ github.workspace }}\.build\wsl-distro\vscode-wsl-smoke.vhdx

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/pr-workspace-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ name: Code OSS (workspace images)
# jobs, and with a .git that their checkouts reuse. A job that mounts an image installs only what
# changed since. The test workflows adopt the images one platform at a time in follow-up pull
# requests, and until then nothing uses them. See .github/workflows/workspace_image/README.md.
# The daily and manual runs also prepare the WSL distribution of the Windows smoke tests (the
# wsl-distro job).
on:
# Every day, so that there is always a recent image of main: the images are kept for 2 days
schedule:
Expand Down Expand Up @@ -384,3 +386,45 @@ jobs:
archive: false
retention-days: 2
if-no-files-found: error

# The WSL distribution that the Windows smoke test shard with the WSL suite imports instead of building it (see
# test/smoke/wslDevContainer.ps1 and electron-smoke-1 in pr-win32-test.yml). It only needs to be recent, so it is
# rebuilt with the daily images and on manual runs, but not on pushes. It runs on the 1ES pool like that shard, as
# GitHub-hosted Windows runners intermittently freeze while WSL2 provisions a distribution. JobId must be unique per
# job. The cache key hashes the files that define the distribution, so that the shard of a commit that changes them
# builds the distribution instead; the shard restores the newest entry of its key.
wsl-distro:
name: Windows (WSL distribution)
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=wsl-distro-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
timeout-minutes: 30
steps:
- name: Checkout microsoft/vscode
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Restore WSL installer
uses: ./.github/actions/restore-wsl-installer

- name: Prepare the WSL distribution
timeout-minutes: 20
shell: pwsh
run: .\test\smoke\wslDevContainer.ps1 -Operation Prepare -Destination "$env:GITHUB_WORKSPACE\.build\wsl-distro\vscode-wsl-smoke.vhdx"
env:
WSL_INSTALLER_CACHE_DIR: ${{ github.workspace }}\.build\wsl-installer

- name: Save the WSL distribution
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: .build/wsl-distro
key: "wsl-distro-v1-${{ runner.os }}-${{ hashFiles('test/smoke/wslDevContainer.ps1', 'build/checksums/wsl.txt') }}-${{ github.run_id }}-${{ github.run_attempt }}"

- name: Publish Log Files
if: failure()
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: logs-windows-x64-wsl-distro-${{ github.run_attempt }}
path: .build/logs
if-no-files-found: ignore
2 changes: 2 additions & 0 deletions test/smoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ The source Agent Host uses a fixture-owned loopback TCP proxy to reach the Windo

The GitHub and Azure Pipelines Windows x64 Electron smoke jobs use [wslDevContainer.ps1](wslDevContainer.ps1) to provision a job-owned WSL 2 distribution with Linux Docker Engine and a non-root test user. Azure Pipelines passes `-CI AzureDevOps` to use its source directory, build ID, job attempt, and pipeline variables; GitHub uses its workspace, run identifiers, and step outputs. Azure enables this coverage for Windows x64 builds with Electron tests enabled, and uses the freshly built Windows product. The test suite retains its existing Exploration exclusion; build scripts do not gate on quality. Both cache the Microsoft-signed WSL kernel installer under a daily key, restore the most recent earlier cache if needed, and refresh it in the background for the next build. A cold cache still requires a synchronous download. The installer signature is checked before use and before updating the cache; the pinned Ubuntu rootfs and Linux server are checked against their SHA256 hashes. The unchanged source-host backend uses the pinned published server recorded in the script. Setup verifies a real container and bind mount before running the UI suite. Cleanup runs even after failure or cancellation, removes the owned distribution and its temporary mock-server firewall rule, and retains Docker diagnostics with the smoke logs. The runner must already have the WSL and VirtualMachinePlatform Windows features enabled; setup does not enable features or reboot Windows.

On GitHub, the `wsl-distro` job of [pr-workspace-images.yml](../../.github/workflows/pr-workspace-images.yml) runs `wslDevContainer.ps1 -Operation Prepare` on `main` every day and on manual runs, on the 1ES pool. Prepare builds the same distribution, up to the pulled dev container image, and exports its VHD, which the job saves in a cache whose key hashes this script and `build/checksums/wsl.txt`. The Windows smoke shard restores the newest entry for its own versions of those files and passes the VHD in `WSL_PREPARED_DISTRO_VHD`. Setup then registers it under the run's distribution name with `wsl --import-in-place`, starts Docker Engine and checks the container and bind mount, instead of downloading and installing everything. Without a prepared distribution (for example until the next daily run after a change to this script), or when importing or starting it fails, Setup builds the distribution as before. Azure Pipelines always builds it.

All remote suites drive host connection, remote folder selection, **Use Dev Container**, prompt submission, the rendered response, and reopening the session through the UI. Model requests use the local mock LLM server, not paid models. They also verify that container startup uses the selected SSH/Tunnel/WSL connection and that the turn travels over the nested Dev Container transport.

Source runs launch the compiled standalone Agent Host with the checkout's matching Electron runtime. Packaged runs launch the shipped `bootstrap-fork.js` / `agentHostMain` entrypoint with IPC, the build's NLS messages, and authenticated WebSocket configuration; they do not require the development-only standalone entrypoint. Since Code OSS does not configure tunnel authentication scopes, the Tunnel fixture creates a private source-app snapshot with only the required test product metadata; it never changes the checkout's product files. Packaged Tunnel runs require the supplied build's tunnel authentication configuration.
Expand Down
Loading
Loading