Skip to content

Fix wp-env builds for PHP 7.4 and 8.0 after Debian bullseye end of life - #322

Merged
galatanovidiu merged 1 commit into
trunkfrom
fix/wp-env-bullseye-apt
Sep 10, 2026
Merged

galatanovidiu merged 1 commit into
trunkfrom
fix/wp-env-bullseye-apt

Conversation

@galatanovidiu

@galatanovidiu galatanovidiu commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What?

See #321 (follow-up to remove this workaround).

Adds bin/patch-wp-env-bullseye.mjs and calls it from the wp-env and wp-env:test npm 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.4 and wordpress:php8.0 are the last official images built on it. wp-env's generated Dockerfile runs apt-get update, which now stops on an expired bullseye-security release file before any test runs:

E: Release file for http://deb.debian.org/debian-security/dists/bullseye-security/InRelease is expired
ERROR: process "/bin/sh -c apt-get -qy update" did not complete successfully: exit code: 100

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/env release 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 bullseye is repointed to archive.debian.org/debian bullseye.
  • bullseye-security is dropped, not repointed, because archive.debian.org does not serve that suite.
  • bullseye-updates is dropped for the same reason.

Decisions:

  • The call is inlined into the wp-env and wp-env:test scripts rather than a postinstall hook. .npmrc sets ignore-scripts = true, which blocks lifecycle hooks and pre/post scripts, so a hook would never run.
  • The script is idempotent and stays silent when the template already contains the bullseye rewrite. Once an installed @wordpress/env ships the upstream fix, the script becomes a no-op.
  • If the template shape changes and the anchor is missing, the script prints a GitHub warning annotation and exits 0, so commands that never build the PHP 7.4 or 8.0 image keep working.
  • wp-env:cli and the lint:php* scripts are unchanged. They run wp-env run, which never builds an image.
  • bin/ is not listed in files in package.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.json in the same PR that bumps @wordpress/env to 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

  1. Run npm ci.
  2. Run WP_ENV_PHP_VERSION=7.4 npm run wp-env:test start. The script prints Patched bullseye apt sources into ... and the environment starts.
  3. Run npm run wp-env:test -- run cli php -- -v and confirm PHP 7.4.
  4. Run npm run test:php and confirm the suite passes.
  5. Run npm run wp-env:test start again without the variable to restore the default PHP image.

Performed locally:

  • Throwaway builds of wordpress:php7.4 and wordpress:php8.0 with the rewrite: apt-get update and apt-get install git sudo succeed.
  • Fresh npm ci, then WP_ENV_PHP_VERSION=7.4 npm run wp-env:test start: image built, php -v reports 7.4.33.
  • npm run test:php on PHP 7.4: 1038 tests, 3889 assertions, 1 skipped, 0 failures.
  • Running the script twice patches once and is silent the second time.

Changelog Entry

Developer - Work around the Debian bullseye end of life so wp-env builds the PHP 7.4 and 8.0 test environments again.

Open WordPress Playground Preview

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.
Copilot AI lite review requested due to automatic review settings September 9, 2026 19:57
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: galatanovidiu <ovidiu-galatan@git.wordpress.org>
Co-authored-by: justlevine <justlevine@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

🟡 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.mjs to inject a bullseye apt-source rewrite into wp-env’s Dockerfile template under node_modules/@wordpress/env.
  • Prefix the wp-env and wp-env:test npm scripts to run the patch script before invoking wp-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

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.78%. Comparing base (d7c610f) to head (539936e).

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           
Flag Coverage Δ
unit 88.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@galatanovidiu
galatanovidiu requested a review from a team September 9, 2026 20:04
@galatanovidiu

Copy link
Copy Markdown
Contributor Author

The same temporary fix can be added to wordpress/ai repo also

@galatanovidiu
galatanovidiu merged commit d6eaa92 into trunk Sep 10, 2026
39 checks passed
@galatanovidiu
galatanovidiu deleted the fix/wp-env-bullseye-apt branch September 10, 2026 05:01
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