Add in-app updater for Linux#3465
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Linux support to Studio’s in-app update flow by bypassing Electron’s platform-limited autoUpdater and implementing a custom polling + dialog-based update prompt on Linux.
Changes:
- Add a Linux-specific update path in
setupUpdates()that polls the WPCOMstudio-app/updatesendpoint and shows a “Download / Later” dialog with manual install instructions. - Implement Linux polling/rescheduling logic and
.debfilename extraction for the apt install hint. - Add Vitest unit tests covering the primary Linux response paths (200/204/error) via
manualCheckForUpdates().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/studio/src/updates.ts | Adds Linux polling updater branch, update-available dialog, and rescheduling logic. |
| apps/studio/src/tests/updates.test.ts | Adds unit tests validating Linux updater dialog behavior and error reporting. |
Comments suppressed due to low confidence (1)
apps/studio/src/updates.ts:295
rescheduleLinuxOrFinish()assigns a newsetTimeoutwithout clearing any existing one. IfpollLinuxUpdates()can be entered concurrently (e.g., via repeated manual checks), multiple timers may accumulate and cause bursts of polling. Clear any existingtimeout(and set it back tonull) before scheduling the next poll.
function rescheduleLinuxOrFinish() {
if ( ! shouldPoll ) {
updaterState = 'done';
return;
}
updaterState = 'polling';
timeout = setTimeout( () => {
console.log( 'Automatically polling for Linux update' );
void pollLinuxUpdates();
}, AUTO_UPDATE_INTERVAL_MS );
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
📊 Performance Test ResultsComparing 5f18545 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
gavande1
approved these changes
May 14, 2026
2 tasks
ivan-ottinger
added a commit
that referenced
this pull request
May 15, 2026
## Related issues Follow-up to [#3464](#3464) (Linux dev build distribution). ## How AI was used in this PR AI-assisted: spotted the duplicated arch/version in the uploaded filename while verifying the first trunk Distribute Dev Builds run, drafted the fix and PR body. Author reviewed. ## Proposed Changes The Linux DEBs uploaded to AppsCDN by [build #16245](https://buildkite.com/automattic/studio/builds/16245) landed with names like: - `studio_1.9.0dev51_amd64-x64-v1.9.0-dev51.deb` - `studio_1.9.0dev51_arm64-arm64-v1.9.0-dev51.deb` Both arch (`amd64` + `x64`) and version (`1.9.0dev51` + `v1.9.0-dev51`) appear twice. The cause: `electron-installer-debian` produces filenames like `studio_1.9.0~dev51_amd64.deb`, then `create_versioned_file` (in this Fastfile) blindly appends `-<arch>-v<version>` to the base name. For Mac the input is a clean `Studio.app.zip`, so the result is `studio-x64-v1.9.0.zip`; for Linux the input already carries arch+version, so the suffix is duplicated. WordPress's media library then strips the `~`, mashing the version slug. This change renames the Linux DEB to a clean `studio.deb` stem in `linux_deb_path` before returning the path. `create_versioned_file` then produces the Mac-style `studio-<arch>-v<version>.deb` (e.g. `studio-x64-v1.9.0-dev51.deb`). The rename is idempotent — retries pick up the already-renamed file. **Why this is cosmetic-only:** - Version checking goes through the WPCOM `studio-app/updates` endpoint, which compares the `version` field in upload metadata (passed explicitly to `upload_file_to_apps_cdn`), not the filename. - `apt`/`dpkg` install behavior reads the DEB's internal control file, not the filename. - The CDN `media_url` is composed from `platform/version/build_number`, not the filename — only `Content-Disposition` after the 302 changes. User-visible impact: the filename users see in their Downloads folder after clicking the in-app update button (#3465) becomes readable. ## Testing Instructions - After this lands on trunk, watch the next Distribute Dev Builds run. - Open the `cdn-link` annotation on the Distribute Dev Builds job. - Click the **Linux - x64 (DEB)** and **Linux - ARM64 (DEB)** links and confirm the downloaded filenames look like `studio-x64-v<version>.deb` / `studio-arm64-v<version>.deb`. ## Pre-merge Checklist - [ ] Have you checked for TypeScript, React or other console errors? - [ ] CI is green.
2 tasks
ivan-ottinger
added a commit
that referenced
this pull request
May 19, 2026
## Related issues Closes [RSM-2587](https://linear.app/a8c/issue/RSM-2587). Last remaining gate before a first Linux beta can ship. ## How AI was used in this PR AI-assisted: drafted the Buildkite group, Fastfile change, and PR body following existing precedents (release-mac, release-windows, dev-linux). Author reviewed. ## Proposed Changes Two coupled changes so release lanes produce and upload Linux DEBs alongside Mac/Windows: **`.buildkite/release-build-and-distribute.yml`** — adds a `release-linux` group with an `x64`/`arm64` matrix, mirroring the structure of `release-mac` and `release-windows`. Uses the Docker-on-`default`-queue pattern Apps Infra established for the dev Linux build group (#3346): runs inside `$NODE_DOCKER_IMAGE` because Amazon Linux on the `default` queue lacks `dpkg`/`fakeroot` required by electron-forge's `MakerDeb`. The `Publish Release Builds` step now also downloads `*.deb` artifacts and depends on `release-linux`. **`fastlane/Fastfile`** — lifts the `release_tag.nil?` gate around the `linux_x64_deb` / `linux_arm64_deb` entries in `update_builds`. On Linux the `.deb` is the only artifact (serves as both update payload and full installer), so the same entry covers dev and release builds. `install_type: 'Update'` keeps the URL convention compatible with the in-app updater's polling path (#3465). ## Testing Instructions CI on this PR only validates parse/lint — the release pipeline doesn't run for regular PRs. The first real verification happens when a release is cut. After this lands: 1. When `code_freeze` / `new_beta_release` runs next, the triggered release pipeline should show a 📦 Build for Linux group running both x64 and arm64 builds in parallel with Mac/Windows. 2. Both Linux jobs should produce a `.deb` artifact at `apps/studio/out/make/deb/**/*.deb`. 3. The Publish Release Builds step should download all DEBs and `distribute_release_build` should upload them to AppsCDN. Linux DEB URLs should appear in the `cdn-link` annotation, the GitHub draft release, and the Slack notification. ## Pre-merge Checklist - [ ] Have you checked for TypeScript, React or other console errors? - [ ] CI is green.
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.
Related issues
Part of RSM-1314 — Linux release prep.
How AI was used in this PR
AI-assisted: drafted the Linux branch in
apps/studio/src/updates.ts, the unit tests, and this PR body. Author reviewed.Proposed Changes
Adds Linux support to the in-app update flow. Electron's built-in
autoUpdateris macOS/Windows only, so this PR adds a custom polling branch inapps/studio/src/updates.tsthat hits the same WPCOM endpoint, parses the agreed Linux response, and shows an OS dialog when an update is available. The dialog has aDownloadbutton that opens the user's browser to the.debURL viashellOpenExternalWrapper; the user installs manually viasudo apt install.Response handling
200 { version, downloadUrl }http:/https:then open viashellOpenExternalWrapper. Reschedule.204404The server runs
version_compare()and returns204when the client is current, so the client trusts the response without further comparison.Out of scope
studio-app/updatesendpoint is already deployed and serves Linux responses today..debinstallation requires root, can't be silent. Flow is intentionally "open browser, user installs."Testing Instructions
Automated: unit tests cover the three main response paths (200, 204, server error). They run in CI; locally:
Visual verification of the dialog on Linux: because no Linux release exists in AppsCDN yet, the server returns
204for any version. To exercise the dialog locally, apply this temporary diff to force-trigger the 200 path, then revert when done. Run on a Linux machine (or VM):Within ~1 second of the main window appearing, the dialog should render. Verify:
sudo apt install ~/Downloads/studio_1.9.9_arm64.deb.shellOpenExternalWrapperfires).Help → Check for Updatestriggers the same dialog.When done, revert:
No regression on Mac/Windows:
npm starton Mac or Windows should behave exactly as before this PR (no entry into the Linux branch).Pre-merge Checklist
npx vitest run apps/studio/src/tests/updates.test.ts).