Repository navigation
Fix wp-env builds for PHP 7.4 and 8.0 after Debian bullseye end of life - #322
Conversation
Debian 11 left the regular mirrors on 2026-08-31, so apt-get update fails while wp-env builds the bullseye-based wordpress:php7.4 and php8.0 images. Gutenberg merged the rewrite in WordPress/gutenberg#82478 but no published wp-env release contains it yet. The call is inlined into the wp-env npm scripts because .npmrc sets ignore-scripts, which blocks lifecycle hooks. The script is a no-op once the installed wp-env carries the rewrite.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
🟡 Changes recommended
The new patch script can still hard-fail wp-env commands if the target template file can’t be read/written (e.g., wp-env internals change), undermining the intended “warn and continue” behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a temporary Node.js patch step to work around Debian bullseye EOL breaking wp-env builds for PHP 7.4/8.0 by rewriting apt sources in @wordpress/env’s Dockerfile template until an upstream @wordpress/env release includes the fix.
Changes:
- Add
bin/patch-wp-env-bullseye.mjsto inject a bullseye apt-source rewrite into wp-env’s Dockerfile template undernode_modules/@wordpress/env. - Prefix the
wp-envandwp-env:testnpm scripts to run the patch script before invokingwp-env.
File summaries
| File | Description |
|---|---|
| package.json | Runs the bullseye patch script before wp-env and wp-env:test commands. |
| bin/patch-wp-env-bullseye.mjs | Implements an idempotent patch to rewrite bullseye apt sources to archive.debian.org in wp-env’s Dockerfile template. |
Review details
- Files reviewed: 1/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #322 +/- ##
=========================================
Coverage 88.78% 88.78%
Complexity 1264 1264
=========================================
Files 54 54
Lines 4164 4164
=========================================
Hits 3697 3697
Misses 467 467
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The same temporary fix can be added to wordpress/ai repo also |
…nd of life" (#344) Reverts #322, now that #337 updates to the version of @wordpress/env where this is fixed. - Closes #321 <!-- wp-playground-preview:start --> <a href="https://playground.wordpress.net?blueprint-url=data:application/json,%7B%22%24schema%22%3A%22https%3A%2F%2Fplayground.wordpress.net%2Fblueprint-schema.json%22%2C%22login%22%3Atrue%2C%22landingPage%22%3A%22%2Fwp-admin%2Fplugins.php%22%2C%22preferredVersions%22%3A%7B%22php%22%3A%228.5%22%2C%22wp%22%3A%22latest%22%7D%2C%22features%22%3A%7B%22networking%22%3Atrue%7D%2C%22steps%22%3A%5B%7B%22step%22%3A%22installPlugin%22%2C%22pluginData%22%3A%7B%22resource%22%3A%22url%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2FWordPress%2Fmcp-adapter%2Freleases%2Fdownload%2Fci-artifacts%2Fpr-344-a15d29f236de950ae8b9ae0c7b4f929088680629-mcp-adapter.zip%22%7D%2C%22options%22%3A%7B%22activate%22%3Atrue%7D%7D%5D%7D" target="_blank" rel="noopener noreferrer"> <img src="https://raw.githubusercontent.com/adamziel/playground-preview/refs/heads/trunk/assets/playground-preview-button.svg" alt="Open WordPress Playground Preview" width="220" height="57" /> </a> <!-- wp-playground-preview:end -->
What?
See #321 (follow-up to remove this workaround).
Adds
bin/patch-wp-env-bullseye.mjsand calls it from thewp-envandwp-env:testnpm scripts, so the PHP 7.4 and 8.0 test environments build again in CI and locally.Why?
Every PHP 7.4 and 8.0 job in the test matrix has failed since 2026-09-07. Debian 11 (bullseye) reached end of life on 2026-08-31 and left the regular mirrors, and
wordpress:php7.4andwordpress:php8.0are the last official images built on it. wp-env's generated Dockerfile runsapt-get update, which now stops on an expiredbullseye-securityrelease file before any test runs:wp-env already rewrites the apt sources for stretch and buster. The same rewrite for bullseye was merged upstream in WordPress/gutenberg#82478 on 2026-09-05, but no published
@wordpress/envrelease contains it yet (latest is 11.14.0 from 2026-08-26).How?
The script inserts the upstream rewrite into the wp-env Dockerfile template in
node_modules, directly after wp-env's own buster block:deb.debian.org/debian bullseyeis repointed toarchive.debian.org/debian bullseye.bullseye-securityis dropped, not repointed, because archive.debian.org does not serve that suite.bullseye-updatesis dropped for the same reason.Decisions:
wp-envandwp-env:testscripts rather than apostinstallhook..npmrcsetsignore-scripts = true, which blocks lifecycle hooks and pre/post scripts, so a hook would never run.@wordpress/envships the upstream fix, the script becomes a no-op.wp-env:cliand thelint:php*scripts are unchanged. They runwp-env run, which never builds an image.bin/is not listed infilesinpackage.json, so the script does not ship in the plugin zip.This is a temporary workaround. Remove the script and the two calls in
package.jsonin the same PR that bumps@wordpress/envto the first release containing WordPress/gutenberg#82478 (any version published from trunk after 2026-09-05). The script already detects that release and becomes a no-op, so nothing breaks if the bump lands first. Tracked in #321.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5.1
Used for: Root-cause investigation, the patch script, and local verification; reviewed and edited by me.
Testing Instructions
npm ci.WP_ENV_PHP_VERSION=7.4 npm run wp-env:test start. The script printsPatched bullseye apt sources into ...and the environment starts.npm run wp-env:test -- run cli php -- -vand confirm PHP 7.4.npm run test:phpand confirm the suite passes.npm run wp-env:test startagain without the variable to restore the default PHP image.Performed locally:
wordpress:php7.4andwordpress:php8.0with the rewrite:apt-get updateandapt-get install git sudosucceed.npm ci, thenWP_ENV_PHP_VERSION=7.4 npm run wp-env:test start: image built,php -vreports 7.4.33.npm run test:phpon PHP 7.4: 1038 tests, 3889 assertions, 1 skipped, 0 failures.Changelog Entry