fix(supported-version): model MariaDB as a separate service from MySQL#370
Draft
rhoerr wants to merge 2 commits into
Draft
fix(supported-version): model MariaDB as a separate service from MySQL#370rhoerr wants to merge 2 commits into
rhoerr wants to merge 2 commits into
Conversation
The `mariadb:11.4` image used by Magento 2.4.9 no longer ships `mysqladmin`, so the existing single MySQL service template (`--health-cmd="mysqladmin ping"`) fails its health check and the `setup-install` lane is torn down at "Initialize containers". A simple swap to `healthcheck.sh --connect --innodb_initialized` would break the `mysql:8.4` lanes (the script is MariaDB-only), so a single template cannot cover both engines. Per @damienwebdev's direction on issue mage-os#365, model MariaDB as its own first-class service, mirroring the existing opensearch/elasticsearch and valkey/redis patterns: - `matrix-type.ts`: add `mariadb: string` to `PackageMatrixVersion` - `service-config.ts`: add `mariadbConfig` with the healthcheck.sh command; leave `mysqlConfig` with `mysqladmin ping` - `build-services.ts`: add `getDatabaseChoice()` that prefers mariadb over mysql; emit either `services.mariadb` or `services.mysql` - version JSON: 22 entries that encoded MariaDB by stuffing the image into the `mysql` field now use a top-level `mariadb` key instead - `build-services.spec.ts`: add a database-selection describe block - `amend-matrix-for-next.spec.ts`: fixtures gain `mariadb: ""` to satisfy the new required field - `.github/workflows/integration.yaml`: port lookup falls back from `job.services.mysql.ports['3306']` to the mariadb key - `supported-version/README.md`: include_services description mentions MariaDB alongside MySQL - `dist/index.js`: rebuilt Fixes mage-os#365 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
f7a7635 to
0b24b58
Compare
Mirrors the matrix schema change in `supported-version`: the install action now treats `services.mariadb` as equivalent to `services.mysql` for both the bin/magento setup:install DB flags and the pre-install `SET GLOBAL log_bin_trust_function_creators = 1;` prep statement (supported by both engines). - `build-command.ts`: add `mariadb?` to the `Services` interface and a small `getDatabaseService()` helper that prefers mariadb when both are present - `index.ts`: route the mysql-cli prep call through the same helper - `build-command.spec.ts`: add mariadb-only and mariadb-preferred-over- mysql cases; rename the existing mysql describe block to "database" - `dist/index.js`: rebuilt Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the 2.4.9
setup-installCI failure reported in #365 by promoting MariaDB to its own first-class service in the matrix schema, mirroring the existingopensearch/elasticsearchandvalkey/redispatterns. This is @damienwebdev's preferred approach from the issue thread (closing the alternate single-template fix from #366).Why the obvious one-template fix doesn't work
The
mariadb:11.4image used for Magento 2.4.9 no longer shipsmysqladmin, so the existing health command--health-cmd="mysqladmin ping"exits non-zero forever and GitHub Actions tears the job down at Initialize containers. The MariaDB-recommended replacement,healthcheck.sh --connect --innodb_initialized, ships in MariaDB images but not inmysql:8.4, which 2.4.6-p15 / 2.4.7-p10 / 2.4.8-p5 still use. A single template can't cover both engines, so each needs its own.What changed —
supported-versionsupported-version/src/matrix/matrix-type.tsmariadb: stringtoPackageMatrixVersionsupported-version/src/services/service-config.tsmariadbConfigtemplate usinghealthcheck.sh --connect --innodb_initialized.mysqlConfigis unchanged.supported-version/src/services/build-services.tsgetDatabaseChoice()helper (mariadb preferred over mysql), branches the emitted service keysupported-version/src/versions/**/*.jsonmysqlfield now use a top-levelmariadbkeysupported-version/src/services/build-services.spec.tssupported-version/src/nightly/amend-matrix-for-next.spec.tsmariadb: ""to satisfy the new required field.github/workflows/integration.yamljob.services.mysql.ports['3306'] || job.services.mariadb.ports['3306']supported-version/README.mdinclude_servicesdescription mentions MariaDBsupported-version/dist/index.jsWhat changed —
setup-installThe companion install action also needs to understand the new key, since matrix lanes whose database is MariaDB now emit
services.mariadb:setup-install/src/build-command.tsmariadb?to theServicesinterface; newgetDatabaseService()helper (mariadb preferred) feeds the--db-host/--db-name/--db-user/--db-passwordflagssetup-install/src/index.tsSET GLOBAL log_bin_trust_function_creators = 1;prep call routes through the same helper (the SQL andmysqlCLI both work against MariaDB)setup-install/src/build-command.spec.tssetup-install/dist/index.jsGitHub Actions exposes each service container under a DNS alias that equals the map key in the
services:block. With this change, any matrix lane whose database is MariaDB now emitsservices.mariadbinstead ofservices.mysql. That affects:>=2.4.7 <2.4.8range, the>=2.4.9 <2.4.10range, the bare default and:nextaliases, plus the individual entries2.4.7through2.4.7-p10and2.4.9.>=1.0 <1.1range, plus the individual entries1.0.2through1.0.6.Downstream workflows that reference
job.services.mysql.*or that connect to hostmysqlfrom a job container will not resolve on those lanes. Two fixes for consumers:Internal consumers in this repo are covered:
setup-installnow accepts either service key (this PR)setup-magentoandwarden/setup-environmentalready connect throughdb/127.0.0.1rather than the service-key aliasintegration.yamlline 77 uses Option A aboveLocal build & test results
supported-version
setup-install
Test plan (CI)
setup-install (magento/project-community-edition:2.4.9)lane reaches Initialize containers successfullysetup-install (magento/project-community-edition:2.4.8-p5)lane still passes (confirmsmysqladmin pingtemplate still works for mysql-image lanes)mariadbvsmysql) and health commandFixes #365
🤖 Generated with Claude Code