Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/env/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### New Features

- Add a `WP_ENV_MARIADB_VERSION` environment variable to choose the MariaDB version used by the database container ([#83751](https://github.com/WordPress/gutenberg/pull/83751)).

## 1.6.0-rc.0 (2020-06-24)

### Bug Fixes
Expand Down
2 changes: 2 additions & 0 deletions packages/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ You can customize the WordPress installation, plugins and themes that the develo

_Note: the port number environment variables (`WP_ENV_PORT` and `WP_ENV_TESTS_PORT`) take precedent over the .wp-env.json values._

_Note: the MariaDB version can be chosen with the `WP_ENV_MARIADB_VERSION` environment variable, such as `WP_ENV_MARIADB_VERSION=10.5`. It defaults to `latest`. MariaDB cannot start on a database written by a newer version. When switching to a lower version, run `wp-env destroy` first. It removes the environment's Docker containers, volumes, and networks, and its local files, not only the database, so everything is recreated on the next start. With a version older than 11.4, `wp db` commands in the `cli` and `tests-cli` containers fail, and `wp-env clean` leaves the database as it is: the MariaDB client in the `wordpress:cli` image requires TLS, and MariaDB servers before 11.4 do not offer it. WordPress itself is not affected. To start over with an empty database, run `wp-env destroy`._

Several types of strings can be passed into the `core`, `plugins`, `themes`, and `mappings` fields.

| Type | Format | Example(s) |
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/build-docker-compose-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = function buildDockerComposeConfig( config ) {
version: '3.7',
services: {
mysql: {
image: 'mariadb',
image: 'mariadb:${WP_ENV_MARIADB_VERSION:-latest}',
ports: [ '3306' ],
environment: {
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes',
Expand Down
8 changes: 8 additions & 0 deletions packages/env/test/build-docker-compose-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ describe( 'buildDockerComposeConfig', () => {
expect.arrayContaining( localSources )
);
} );

it( 'should let Docker Compose choose the MariaDB version from WP_ENV_MARIADB_VERSION', () => {
const dockerConfig = buildDockerComposeConfig( CONFIG );

expect( dockerConfig.services.mysql.image ).toBe(
'mariadb:${WP_ENV_MARIADB_VERSION:-latest}'
);
} );
} );
Loading