Skip to content

Repair wp/7.1 branch Actions: Add a mariadbVersion option to wp-env - #83810

Merged
desrosj merged 1 commit into
fix-actions-7.1/remove-install-nvm-stepfrom
fix-actions-7.1/add-mariadb-version-option
Oct 26, 2026
Merged

desrosj merged 1 commit into
fix-actions-7.1/remove-install-nvm-stepfrom
fix-actions-7.1/add-mariadb-version-option

Conversation

@desrosj

@desrosj desrosj commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Part of #82781.

What?

Adds a mariadbVersion option to .wp-env.json and a WP_ENV_MARIADB_VERSION environment variable to wp-env, so the MariaDB version it uses can be chosen.

  • The option can be set at the top level of .wp-env.json or per environment (env.development, env.tests), like phpVersion. WP_ENV_MARIADB_VERSION overrides both environments.
  • Accepted values are "lts", "latest", or a numeric version such as "10.11" or "11.4.2". Anything else fails validation, in the config file or the environment variable. The version check is anchored and shared with phpVersion, so a phpVersion or WP_ENV_PHP_VERSION such as 8.2-apache is now rejected too.
  • Unset or null keeps today's mariadb:lts image. The image tags, the default and getMariaDBImage() live in config/db-env.js.
  • Both database services share one health check (MARIADB_HEALTHCHECK). It runs healthcheck.sh --connect --innodb_initialized only when the data directory has .my-healthcheck.cnf and the image has healthcheck.sh. Otherwise it pings the server over TCP on 127.0.0.1 with mariadb-admin (11.0 and newer only ship this name) or mysqladmin (versions before 10.4 only ship this name).
  • When wp-env start fails because a database was last used by a newer MariaDB version, which MariaDB cannot downgrade from, it stops with a DatabaseDowngradeError that names both versions.
  • The CLI image wraps each MariaDB client it has (mariadb, mariadb-check, mariadb-dump and the mysql* equivalents) to add --skip-ssl-verify-server-cert after --no-defaults, so wp db commands and wp-env reset work with servers before 11.4.
  • The option is added to schemas/json/wp-env.json and documented in the README, and packages/env/CHANGELOG.md gets entries.

Why?

This branch's wp-env (11.11.0) always runs a floating MariaDB image, which keeps moving to releases far newer than anything WordPress 7.1 was released against. There's no way to pin an era-appropriate version for testing. The next PR in this stack uses this option to do that.

The health check has to work for every version the option allows. MariaDB 10.2 and 10.3 images ship healthcheck.sh without the healthcheck user it needs, images built before 2022 and older patch tags (such as 10.5.8 and 10.6.4) have no script at all, and a data volume written by a newer image keeps .my-healthcheck.cnf when an older image without the script runs on it. The client wrappers are needed because the MariaDB 11.4+ client in the CLI image requires TLS, which servers before 11.4 do not offer. WP-CLI adds the same flag from db-command 3.0, so the wrappers can be removed once a WP-CLI release with it is in the image.

How?

This is the trunk change from #83751 (at e02f866), applied as is, except the error for a missing MariaDB image: this branch's pullAll() is not wrapped in a catch, so a missing image already fails with Docker's own error. The code paths match trunk: parse-config.js, get-config-from-environment-vars.js, validate-config.js (checkMariaDBVersion()), config/db-env.js, runtime/docker/build-docker-compose-config.js (MARIADB_HEALTHCHECK), runtime/docker/database-downgrade.js, runtime/docker/docker-config.js (client wrappers) and runtime/errors.js. The tests use Jest instead of trunk's Vitest; the health check and wrapper behavior tests run the commands through /bin/sh with stub tools and are skipped on Windows.

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

🤖 Generated with Claude Code

@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Sep 30, 2026
@desrosj desrosj self-assigned this Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3cb45f70-cbbd-4d85-882e-32f827f8afaf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: 0 B

Total Size: 7.75 MB

60706bd Run

@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from 07c4df1 to fe42e96 Compare October 5, 2026 19:56
@desrosj
desrosj marked this pull request as ready for review October 7, 2026 13:01
@github-actions

github-actions Bot commented Oct 7, 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.

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: desrosj <desrosj@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from fe42e96 to 668cf57 Compare October 7, 2026 13:42
@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from 668cf57 to 8b7a05f Compare October 7, 2026 15:55
@desrosj
desrosj removed this pull request from stack #83629 October 8, 2026 21:07
@desrosj
desrosj changed the base branch from fix-actions-7.1/remove-install-nvm-step to wp/7.1 October 8, 2026 21:08
@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from 8b7a05f to 534675b Compare October 8, 2026 21:08
@desrosj
desrosj changed the base branch from wp/7.1 to fix-actions-7.1/remove-install-nvm-step October 8, 2026 21:09
@desrosj
desrosj added this pull request to stack #84346 October 8, 2026 21:10
@desrosj
desrosj removed this pull request from stack #84346 October 9, 2026 23:21
@desrosj
desrosj changed the base branch from fix-actions-7.1/remove-install-nvm-step to wp/7.1 October 9, 2026 23:21
@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from 534675b to ea21aa0 Compare October 9, 2026 23:22
@desrosj
desrosj changed the base branch from wp/7.1 to fix-actions-7.1/remove-install-nvm-step October 9, 2026 23:23
@desrosj
desrosj added this pull request to stack #84466 October 9, 2026 23:23
@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from ea21aa0 to d50652b Compare October 19, 2026 17:02
@desrosj
desrosj removed this pull request from stack #84466 October 21, 2026 18:35
@desrosj
desrosj added this pull request to stack #85326 October 21, 2026 18:36
@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from d50652b to 570bc30 Compare October 24, 2026 18:02
@desrosj
desrosj removed this pull request from stack #85326 October 24, 2026 18:04
@desrosj
desrosj added this pull request to stack #85508 October 24, 2026 18:04

@andrewserong andrewserong 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.

Looks like a pretty clean backport of #83751 to me. I see there were a couple of follow-up comments on that PR which either don't apply to this PR, or seem unlikely to be of any consequence since this branch is about repairing CI (i.e. the injected wrappers for the various commands seem fine to me, and I doubt anyone's going to be using --defaults-* options from this or earlier branches).

LGTM!

@desrosj
desrosj force-pushed the fix-actions-7.1/add-mariadb-version-option branch from 570bc30 to 60706bd Compare October 26, 2026 17:58
@desrosj desrosj added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Oct 26, 2026
@github-actions github-actions Bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Oct 26, 2026
@desrosj
desrosj merged commit e5b70fd into wp/7.1 Oct 26, 2026
57 of 96 checks passed
@desrosj
desrosj deleted the fix-actions-7.1/add-mariadb-version-option branch October 26, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Tool] Env /packages/env [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants