Repository navigation
Repair wp/7.1 branch Actions: Add a mariadbVersion option to wp-env - #83810
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
|
🤖 PR meta 🤖📦 Bundle sizeSize Change: 0 B Total Size: 7.75 MB
|
07c4df1 to
fe42e96
Compare
|
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. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
fe42e96 to
668cf57
Compare
668cf57 to
8b7a05f
Compare
8b7a05f to
534675b
Compare
534675b to
ea21aa0
Compare
ea21aa0 to
d50652b
Compare
d50652b to
570bc30
Compare
andrewserong
left a comment
There was a problem hiding this comment.
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!
570bc30 to
60706bd
Compare
Part of #82781.
What?
Adds a
mariadbVersionoption to.wp-env.jsonand aWP_ENV_MARIADB_VERSIONenvironment variable towp-env, so the MariaDB version it uses can be chosen..wp-env.jsonor per environment (env.development,env.tests), likephpVersion.WP_ENV_MARIADB_VERSIONoverrides both environments."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 withphpVersion, so aphpVersionorWP_ENV_PHP_VERSIONsuch as8.2-apacheis now rejected too.nullkeeps today'smariadb:ltsimage. The image tags, the default andgetMariaDBImage()live inconfig/db-env.js.MARIADB_HEALTHCHECK). It runshealthcheck.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).wp-env startfails because a database was last used by a newer MariaDB version, which MariaDB cannot downgrade from, it stops with aDatabaseDowngradeErrorthat names both versions.mariadb,mariadb-check,mariadb-dumpand themysql*equivalents) to add--skip-ssl-verify-server-certafter--no-defaults, sowp dbcommands andwp-env resetwork with servers before 11.4.schemas/json/wp-env.jsonand documented in the README, andpackages/env/CHANGELOG.mdgets 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.shwithout the healthcheck user it needs, 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. 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) andruntime/errors.js. The tests use Jest instead of trunk's Vitest; the health check and wrapper behavior tests run the commands through/bin/shwith 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