Skip to content

Commit ea80ac8

Browse files
committed
Build/Test Tools: Support older MariaDB versions in local Docker environment.
Older versions of MariaDB did not contain the `mariadb-admin` command. This command is configured as the `healthcheck` used by the local Docker environment to confirm that the database container has successfully started and is reporting as “healthy”. The current result is a failure when starting the environment while using one of the affected older versions. For MariaDB versions 10.3 and earlier, the `mysqladmin` command was used instead. Since WordPress still technically supports back to MariaDB 5.5, the local environment should support running these versions. This updates the environment configuration to take this into account when performing a `healthcheck` test. The README file is also updated to reflect that the same workaround added in [57568] for MySQL <= 5.7 is required when using MariaDB 5.5 on an Apple silicon machine. Props johnbillion. See #62221. git-svn-id: https://develop.svn.wordpress.org/trunk@59484 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d576e24 commit ea80ac8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/reusable-phpunit-tests-v3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171

172172
- name: WordPress Docker container debug information
173173
run: |
174-
docker compose run --rm mysql ${{ env.LOCAL_DB_TYPE }} --version
174+
docker compose run --rm mysql ${{ env.LOCAL_DB_TYPE == 'mariadb' && contains( fromJSON('["5.5", "10.0", "10.1", "10.2", "10.3"]'), env.LOCAL_DB_VERSION ) && 'mysql' || env.LOCAL_DB_TYPE }} --version
175175
docker compose run --rm php php --version
176176
docker compose run --rm php php -m
177177
docker compose run --rm php php -i

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,14 @@ The development environment can be reset. This will destroy the database and att
139139
npm run env:reset
140140
```
141141

142-
### Apple Silicon machines and old MySQL versions
142+
### Apple Silicon machines and old MySQL/MariaDB versions
143143

144-
The MySQL Docker images do not support Apple Silicon processors (M1, M2, etc.) for MySQL versions 5.7 and earlier.
144+
Older MySQL and MariaDB Docker images do not support Apple Silicon processors (M1, M2, etc.). This is true for:
145145

146-
When using MySQL <= 5.7 on an Apple Silicon machine, you must create a `docker-compose.override.yml` file with the following contents:
146+
- MySQL versions 5.7 and earlier
147+
- MariaDB 5.5
148+
149+
When using these versions on an Apple Silicon machine, you must create a `docker-compose.override.yml` file with the following contents:
147150

148151
```
149152
services:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ services:
8282
command: ${LOCAL_DB_AUTH_OPTION-}
8383

8484
healthcheck:
85-
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
85+
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then case \"$LOCAL_DB_VERSION\" in 5.5|10.0|10.1|10.2|10.3) mysqladmin ping -h localhost || exit $?;; *) mariadb-admin ping -h localhost || exit $?;; esac; else mysqladmin ping -h localhost || exit $?; fi" ]
8686
timeout: 5s
8787
interval: 5s
8888
retries: 10

0 commit comments

Comments
 (0)