Repository navigation
Repair wp/6.3 branch Actions: Replace wp-env's database check with a MariaDB health check - #83868
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Size Change: 0 B Total Size: 1.46 MB ℹ️ View Unchanged
|
9177c4d to
5565833
Compare
5565833 to
bef4a88
Compare
bef4a88 to
58c67e7
Compare
|
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. |
58c67e7 to
94f883b
Compare
94f883b to
460db5c
Compare
|
Size Change: 0 B Total Size: 1.46 MB ℹ️ View Unchanged
|
460db5c to
2795416
Compare
2795416 to
f19246c
Compare
|
Size Change: 0 B Total Size: 1.46 MB ℹ️ View Unchanged
|
Part of #82930.
What?
Ports #75046 ("wp-env: Fix MySQL startup race condition causing database connection errors") to this branch's
wp-env:mysqlandtests-mysql) share a health check (MARIADB_HEALTHCHECK), plusMARIADB_AUTO_UPGRADEso existing databases get the userhealthcheck.shneeds. It runs MariaDB'shealthcheck.sh --connect --innodb_initializedonly when the data directory has.my-healthcheck.cnfand the image hashealthcheck.sh. Otherwise it pings the server over TCP on127.0.0.1withmariadb-admin(11.0 and newer only ship this name) ormysqladmin(versions before 10.4 only ship this name).wordpressandtests-wordpressdepend on their database withcondition: service_healthy, so Docker Compose only starts WordPress once MariaDB is ready.wp db checkconnection check, its 30-second retry loop and the extra 4-second sleep are removed fromwp-env start.wp-env startstartsmysqlandtests-mysqltogether, andwp-env cleanstarts only the database(s) it resets.lib/init-config.js) wraps each MariaDB client it has (mariadb,mariadb-check,mariadb-dumpand themysql*equivalents) to add--skip-ssl-verify-server-certafter--no-defaults, so the client falls back to an unencrypted connection when the server has no TLS.cliDockerFileContentsis exported for the tests.packages/env/CHANGELOG.mdgets trunk's entry, extended to describe the fallback ping, with links to wp-env: Fix MySQL startup race condition causing database connection errors #75046 and Env: Add an option to choose the MariaDB version #83751, and an entry sayingwp dbcommands, and sowp-env clean, now work with amariadbVersionolder than 11.4.Why?
wp db checkrunsmariadb-checkin theclicontainer. The client in the currentwordpress:cliimage (MariaDB 11.8) requires TLS by default, and WP-CLI runs it with--no-defaults, so nothing can turn that off. MariaDB releases before 11.4 have no TLS unless it's configured, so the check fails withTLS/SSL error: SSL is required, but the server does not support itandwp-env startstops. The next PR in this stack, #83827, pins MariaDB10.11, which is one of those releases, so without this change every job that startswp-envwould fail there.trunkremovedwp db checkin #75046 and waits for MariaDB with a health check instead, which doesn't use the MySQL client at all.The same TLS requirement would break every other
wp dbcommand against the10.11pin, including the database reset inwp-env clean. #83751 wraps the clients in the CLI image to skip server certificate verification, which is the flag WP-CLI adds from db-command 3.0, so the wrappers can be removed once a WP-CLI release with it is in the image.How?
The changes follow #75046 hunk for hunk, adapted to this branch's file layout (
commands/start.js,commands/clean.jsandwordpress.js), except the health check command, which is #83751's runtime check (at e02f866). The client wrappers are #83751's, placed in this branch'slib/init-config.js.#75046's health check runs
healthcheck.shunconditionally, which doesn't work for every version themariadbVersionoption allows. MariaDB 10.2 and 10.3 images ship the script without the healthcheck user, images built before 2022 and older patch tags (such as10.5.8and10.6.4) have no script at all, and a data volume written by a newer image keeps.my-healthcheck.cnfwhen an older image without the script runs on it. Those databases would never become healthy, so WordPress would never start. The check is decided at runtime rather than by image tag, so every version, includingltsandlatest, uses the same check.#75046's two compose-builder tests are ported, and new tests run the health check command and the client wrappers through
/bin/shwith stub tools (skipped on Windows; they use.split().join()rather thanreplaceAll(), which this branch's Node 14 lacks).Verified locally: the
10.11pin becomes healthy andwp db checkandwp-env clean developmentwork against it, and"mariadbVersion": "10.3"becomes healthy through the ping.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