Skip to content

ci: build workspace images of main for the PR test jobs - #346211

Merged
Ladislau Szomoru (lszomoru) merged 3 commits into
mainfrom
lszomoru/agents/phase1-build-workspace-images-main
Nov 5, 2026
Merged

Ladislau Szomoru (lszomoru) merged 3 commits into
mainfrom
lszomoru/agents/phase1-build-workspace-images-main

Conversation

@lszomoru

@lszomoru Ladislau Szomoru (lszomoru) commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Phase 1 of #345429: build the workspace images of main for Linux, macOS and Windows, without changing any PR check. Nothing uses the images yet: the test workflows (pr-linux-test.yml, pr-darwin-test.yml, pr-win32-test.yml) adopt them one platform at a time in follow-up pull requests, which can then measure the gains on each platform. The design is in .github/workflows/workspace_image/README.md.

Changes

  • pr-workspace-images.yml (new): builds a disk image of a ready workspace of main (dependencies, Electron, Playwright browsers, .git) on the runners of the test jobs, and uploads it as an artifact kept for 2 days. It runs every day at 05:00 UTC, when an input of the install, of the native builds or of the prepared Electron changes on main, on workflow_dispatch, and on workflow_call.
  • workspace_image/ (new): image.ts builds, packs and restores the images (dependency-free, as the jobs run it before they check out); win32/vhd.ps1 and win32/Vhd.cs create and attach the Windows VHDX with the virtual disk API.
  • setup-electron: stamps the Electron that it prepares in .build/electron.stamp, and keeps an Electron prepared from the same inputs, as an image holds. Today's jobs start from an empty workspace, so they prepare Electron as before; lookup-only is unchanged. This lands now because a change to setup-electron doesn't rebuild the images.
  • workspaceImage.test.ts (new): checks that NATIVE_BUILD_INPUTS in image.ts matches the inputs of computeNodeModulesBaseCacheKey.

Differences from #345429

  • No image.ts deps command: build: remove the install-state fast path and install-fast #346049 removed the install state (build/npm/installStateHash.ts, .postinstall-state) that it compared. A job that uses an image will run its install steps on top of it, and pnpm installs only what changed.
  • A daily schedule, and image.ts trusts the images of scheduled runs.
  • Comments and the README describe phase 1: no test workflow mounts the images yet, and there is no workspace_image_branch input on main.
  • Left for the follow-up pull requests: the consumer steps in the test workflows, actions: read for them in pr.yml, the workspace_image/** entry in build/ripple/vscode.jsonc, and the detectMissingCaches.test.ts update for Windows.

How to test

  • The images were built on this branch with a temporary push trigger for the branch, since dropped: run 42001446886 built all three platforms, and run 42002398690 built them again after the move of the Windows scripts into win32/. Images built from a branch are never used: jobs only use images of main.
  • After the merge, the workflow runs on main; gh workflow run pr-workspace-images.yml also builds the images on demand.
  • The PR checks run every test job, as setup-electron changed: they exercise the stamp with an empty workspace.

Validation run locally:

  • ./node_modules/.bin/tsc --noEmit --strict --module nodenext --moduleResolution nodenext --target es2024 --lib es2024,dom --types node --skipLibCheck --erasableSyntaxOnly --noUnusedLocals --noUnusedParameters .github/workflows/workspace_image/image.ts: passed
  • ./node_modules/.bin/eslint .github/workflows/workspace_image/image.ts build/lib/test/workspaceImage.test.ts: passed
  • cd build && node --test lib/test/workspaceImage.test.ts lib/test/detectMissingCaches.test.ts lib/test/detectChanges.test.ts: passed (23 tests)
  • go run github.com/rhysd/actionlint/cmd/actionlint@latest -shellcheck= .github/workflows/pr-workspace-images.yml: only the custom runner labels are reported

Phase 1 of #345429: pr-workspace-images.yml builds a disk image of a
ready workspace of main for each platform, when an input of the
install, of the native builds or of the prepared Electron changes on
main. Nothing uses the images yet: the test workflows adopt them one
platform at a time in follow-up pull requests.

setup-electron stamps the Electron that it prepares in
.build/electron.stamp, and keeps an Electron prepared from the same
inputs, as the images hold. Jobs that start from an empty workspace
prepare Electron as before.

Unlike in the pull request, image.ts has no `deps` command, as #346049
removed the install state that it compared: a job that uses an image
runs its install steps on top of it, and pnpm installs only what
changed.

Co-authored-by: Alex Dima <alexdima@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pr-workspace-images.yml also runs every day at 05:00 UTC, so that a
recent image of main is always available: the images are kept for 2
days, and the pushes that change an input of the images can be days
apart. image.ts trusts the images of the scheduled runs, which run on
main like the pushes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The privileged ext4/APFS/ReFS image lifecycle and Win32 VHDX interop need creation, mounting, and restore/fallback validation across all three runner platforms; supplied checks cover only static checks and cache inputs.

No open issues 🎉

What changed in this PR

Adds phase-one infrastructure to build prepared workspace images of main for Linux, macOS, and Windows. PR test workflows do not consume the images yet; adoption is deferred to follow-up PRs.

Changes:

  • Adds scheduled and input-triggered image builds with two-day artifact retention.
  • Introduces image packing, restoration, compatibility checks, and Windows virtual-disk helpers.
  • Adds Electron input stamps for reuse, documentation, and a test guarding native-build input parity with cache keys.
File Description
build/​lib/​test/​workspaceImage.test.ts Checks native-build inputs against dependency-cache key inputs.
.github/​workflows/​workspace_image/​vhd.ps1 Creates, mounts, and detaches Windows workspace disks.
.github/​workflows/​workspace_image/​Vhd.cs Provides Windows virtual-disk API bindings.
.github/​workflows/​workspace_image/​README.md Documents image design, trust checks, and planned adoption.
.github/​workflows/​workspace_image/​image.ts Implements image preparation, packing, discovery, and restoration.
.github/​workflows/​pr-workspace-images.yml Builds and uploads prepared images for all three platforms.
.github/​workflows/​node_modules_cache/​README.md Documents reuse of stamped Electron installations.
.github/​actions/​setup-electron/​action.yml Stamps prepared Electron and skips preparation when inputs match.

Review effort: Balanced

vhd.ps1 and Vhd.cs only build and attach the Windows images, so they
move to workspace_image/win32. The jobs download the scripts into the
same folders, so that image.ts finds vhd.ps1 in win32 both in the
repository and on the runners.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lszomoru
Ladislau Szomoru (lszomoru) force-pushed the lszomoru/agents/phase1-build-workspace-images-main branch from 4c61b12 to c8b5449 Compare November 5, 2026 09:30
@lszomoru
Ladislau Szomoru (lszomoru) marked this pull request as ready for review November 5, 2026 11:33
@lszomoru
Ladislau Szomoru (lszomoru) merged commit 4d2fba6 into main Nov 5, 2026
59 checks passed
@lszomoru
Ladislau Szomoru (lszomoru) deleted the lszomoru/agents/phase1-build-workspace-images-main branch November 5, 2026 11:39
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants