mirror of
git://develop.git.wordpress.org/
synced 2025-01-29 10:38:22 +01:00
ad20852640
This updates the 4.8 branch to utilize the new reusable workflows in trunk introduced in [58165]. This also includes backports for a some additional improvements and bug fixes that are necessary for the local development environment to continue working long term: - The image and platform properties for the mysql container have been updated to always prefer `amd64` containers (#60822). - `macos-13` is now pinned for MacOS jobs instead of `macos-latest` (#61340). - Migrating to Docker Compose V2 (#60901). - Removing the version property from docker-compose.yml (#59416). - Improvements to how artifacts and comments for Playground testing are generated. - Removing SVN related commands causing failures (#61216). - Updating the `actions/github-scripts` action to the latest version. - Improvements to the `healthcheck` command for the `mysql` container (#58867). Merges [51673], [53552], [56464], [57918], [58157], [57124], [57125], [57249] to the 4.8 branch. Props johnbillion, joemcgill, swissspidy, thelovekesh, narenin, mukesh27, JeffPaul, peterwilsoncc, zieladam, ockham, SergeyBiryukov, jorbin, Clorith, afragen, jrf. See #58867, #61340, #60822, #61216, #60901, #61101, #59416, #59805, #61213. git-svn-id: https://develop.svn.wordpress.org/branches/4.8@58637 602fd350-edb4-49c9-b593-d223f7449a82
37 lines
1.7 KiB
JavaScript
37 lines
1.7 KiB
JavaScript
const dotenv = require( 'dotenv' );
|
|
const dotenvExpand = require( 'dotenv-expand' );
|
|
const { execSync } = require( 'child_process' );
|
|
|
|
dotenvExpand( dotenv.config() );
|
|
|
|
// Start the local-env containers.
|
|
execSync( 'docker compose up -d wordpress-develop', { stdio: 'inherit' } );
|
|
|
|
// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
|
|
if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
|
|
// VBoxManage is added to the PATH on every platform except Windows.
|
|
const vboxmanage = process.env.VBOX_MSI_INSTALL_PATH ? `${ process.env.VBOX_MSI_INSTALL_PATH }/VBoxManage` : 'VBoxManage'
|
|
|
|
// Check if the port forwarding is already configured for this port.
|
|
const vminfoBuffer = execSync( `"${ vboxmanage }" showvminfo "${ process.env.DOCKER_MACHINE_NAME }" --machinereadable` );
|
|
const vminfo = vminfoBuffer.toString().split( /[\r\n]+/ );
|
|
|
|
vminfo.forEach( ( info ) => {
|
|
if ( ! info.startsWith( 'Forwarding' ) ) {
|
|
return;
|
|
}
|
|
|
|
// `info` is in the format: Forwarding(1)="tcp-port8889,tcp,127.0.0.1,8889,,8889"
|
|
// Parse it down so `rule` only contains the data inside quotes, split by ','.
|
|
const rule = info.replace( /(^.*?"|"$)/, '' ).split( ',' );
|
|
|
|
// Delete rules that are using the port we need.
|
|
if ( rule[ 3 ] === process.env.LOCAL_PORT || rule[ 5 ] === process.env.LOCAL_PORT ) {
|
|
execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 delete ${ rule[ 0 ] }`, { stdio: 'inherit' } );
|
|
}
|
|
} );
|
|
|
|
// Add our port forwarding rule.
|
|
execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 "tcp-port${ process.env.LOCAL_PORT },tcp,127.0.0.1,${ process.env.LOCAL_PORT },,${ process.env.LOCAL_PORT }"`, { stdio: 'inherit' } );
|
|
}
|