Skip to content

Commit

Permalink
Merge branch 'trunk' into update/docs-pt-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
terriann authored Jun 13, 2024
2 parents 6b4e4cb + 6a0c704 commit 2e708d5
Show file tree
Hide file tree
Showing 21 changed files with 694 additions and 609 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Review Dependencies
steps:
- name: Harden Runner
uses: step-security/[email protected].0
uses: step-security/[email protected].1
with:
egress-policy: block
allowed-endpoints: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devenv-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Preload Docker images
run: |
vip dev-env create --app-code image --php 8.0 --mu-plugins image -e false -p true --mailpit true --photon true && \
vip dev-env create --app-code image --php 8.2 --mu-plugins image -e false -p true --mailpit true --photon true && \
vip dev-env start -w && \
vip dev-env destroy
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/dev-env-e2e/.lando_mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ services:
php:
type: compose
services:
image: ghcr.io/automattic/vip-container-images/php-fpm:8.0
image: ghcr.io/automattic/vip-container-images/php-fpm:8.2
command: run.sh
working_dir: /wp
environment:
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/dev-env-e2e/instance_data_mariadb.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"wpTitle":"VIP Dev","multisite":false,"elasticsearch":false,"php":"ghcr.io/automattic/vip-container-images/php-fpm:8.0","mariadb":"10.3","mediaRedirectDomain":"","wordpress":{"mode":"image","tag":"6.1"},"muPlugins":{"mode":"image"},"appCode":{"mode":"image"},"phpmyadmin":false,"xdebug":false,"xdebugConfig":"","siteSlug":"vip-local"}
{"wpTitle":"VIP Dev","multisite":false,"elasticsearch":false,"php":"ghcr.io/automattic/vip-container-images/php-fpm:8.2","mariadb":"10.3","mediaRedirectDomain":"","wordpress":{"mode":"image","tag":"6.1"},"muPlugins":{"mode":"image"},"appCode":{"mode":"image"},"phpmyadmin":false,"xdebug":false,"xdebugConfig":"","siteSlug":"vip-local"}
28 changes: 25 additions & 3 deletions __tests__/devenv-e2e/004-stop.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe( 'vip dev-env stop', () => {
env,
} );
expect( result.rc ).toBeGreaterThan( 0 );
expect( result.stderr ).toContain( "Error: Environment doesn't exist." );
expect( result.stderr ).toContain( 'Error: Environment not found.' );

return expect( checkEnvExists( slug ) ).resolves.toBe( false );
} );
Expand All @@ -73,7 +73,7 @@ describe( 'vip dev-env stop', () => {
true
);
expect( result.rc ).toBe( 0 );
expect( result.stdout ).toContain( 'environment stopped' );
expect( result.stdout ).toContain( `environment "${ slug }" stopped` );

const containersAfterStop = await getContainersForProject( docker, slug );
expect( containersAfterStop ).toHaveLength( 0 );
Expand All @@ -91,11 +91,33 @@ describe( 'vip dev-env stop', () => {
true
);
expect( result.rc ).toBe( 0 );
expect( result.stdout ).toContain( 'environment stopped' );
expect( result.stdout ).toContain( `environment "${ slug }" stopped` );

const containersAfterStop = await getContainersForProject( docker, slug );
expect( containersAfterStop ).toHaveLength( 0 );

await destroyEnvironment( cliTest, slug, env );
} );

it( 'should be able to stop all environments', async () => {
const slug1 = getProjectSlug();
const slug2 = getProjectSlug();
expect( await checkEnvExists( slug1 ) ).toBe( false );
expect( await checkEnvExists( slug2 ) ).toBe( false );

await createAndStartEnvironment( cliTest, slug1, env );
await createAndStartEnvironment( cliTest, slug2, env );

const result = await cliTest.spawn(
[ process.argv[ 0 ], vipDevEnvStop, '--all' ],
{ env },
true
);
expect( result.rc ).toBe( 0 );
expect( result.stdout ).toContain( `environment "${ slug1 }" stopped` );
expect( result.stdout ).toContain( `environment "${ slug2 }" stopped` );

await destroyEnvironment( cliTest, slug1, env );
await destroyEnvironment( cliTest, slug2, env );
} );
} );
2 changes: 1 addition & 1 deletion __tests__/e2e_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rem dev-env tests

echo "== Creating dev-env"

call vip dev-env create --app-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false --mailpit false --photon false
call vip dev-env create --app-code image --title Test --multisite false --php 8.2 --wordpress trunk --mu-plugins image -e false -p false -x false --mailpit false --photon false

if NOT %errorlevel% == 0 (
echo "== Failed to create dev-env"
Expand Down
26 changes: 15 additions & 11 deletions __tests__/lib/dev-environment/dev-environment-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,15 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
title: 'a',
muPlugins: 'mu',
appCode: 'code',
wordpress: 'wp',
wordpress: testReleaseWP,
},
default: {},
},
{
preselected: {
muPlugins: 'mu',
appCode: 'code',
wordpress: 'wp',
wordpress: testReleaseWP,
},
default: {
title: 'b',
Expand All @@ -397,7 +397,7 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
prompt.mockResolvedValue( { input: input.default.title } );
selectRunMock.mockResolvedValue( '' );

const result = await promptForArguments( input.preselected, input.default );
const result = await promptForArguments( input.preselected, input.default, false, true );

if ( input.preselected.title ) {
expect( prompt ).toHaveBeenCalledTimes( 1 );
Expand Down Expand Up @@ -463,7 +463,7 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
confirmRunMock.mockResolvedValue( input.default.multisite );
selectRunMock.mockResolvedValue( '' );

const result = await promptForArguments( input.preselected, input.default );
const result = await promptForArguments( input.preselected, input.default, false, true );

if ( 'multisite' in input.preselected ) {
expect( prompt ).toHaveBeenCalledTimes( 0 );
Expand Down Expand Up @@ -503,7 +503,7 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
confirmRunMock.mockResolvedValue( input.default.mediaRedirectDomain );
selectRunMock.mockResolvedValue( '' );

const result = await promptForArguments( input.preselected, input.default );
const result = await promptForArguments( input.preselected, input.default, false, true );

if ( input.preselected.mediaRedirectDomain ) {
expect( confirmRunMock ).toHaveBeenCalledTimes( 5 );
Expand Down Expand Up @@ -541,7 +541,7 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
] )( 'should handle mariadb', async input => {
selectRunMock.mockResolvedValue( '' );

const result = await promptForArguments( input.preselected, input.default );
const result = await promptForArguments( input.preselected, input.default, false, true );

const expectedMaria = input.preselected.mariadb
? input.preselected.mariadb
Expand Down Expand Up @@ -588,14 +588,18 @@ describe( 'lib/dev-environment/dev-environment-cli', () => {
[ '8.1', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.1' ].image ],
[ '8.2', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.2' ].image ],
[ '8.3', DEV_ENVIRONMENT_PHP_VERSIONS[ '8.3' ].image ],
[ 'image:php:8.0', 'image:php:8.0' ],
[
'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:8.0',
'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:8.0',
],
] )( 'should process versions correctly', async ( input, expected ) => {
const actual = resolvePhpVersion( input );
expect( actual ).toStrictEqual( expected );
} );

it.each( [ [ '7.4' ], [ 'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:7.3' ] ] )(
'should throw an error for invalid version',
async version => {
expect( () => resolvePhpVersion( version ) ).toThrow(
`Unknown or unsupported PHP version: ${ version }`
);
}
);
} );
} );
2 changes: 1 addition & 1 deletion __tests__/lib/dev-environment/dev-environment-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe( 'lib/dev-environment/dev-environment-core', () => {
if ( /docker-compose/.test( command ) ) {
callback( null, '2.12.2', '' );
} else if ( /docker/.test( command ) ) {
callback( null, '23.0.4', '' );
callback( null, '{"ServerVersion": "25.0.2"}', '' );
} else {
callback( new Error(), '', '' );
}
Expand Down
2 changes: 0 additions & 2 deletions assets/dev-env.lando.template.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ services:
image: ghcr.io/automattic/vip-container-images/nginx:latest
command: nginx -g "daemon off;"
environment:
LANDO_NO_SCRIPTS: 1
LANDO_NEEDS_EXEC: 1
volumes:
- ./nginx/extra.conf:/etc/nginx/conf.extra/extra.conf
Expand Down Expand Up @@ -226,7 +225,6 @@ services:
- ":8025"
environment:
LANDO_NO_USER_PERMS: 1
LANDO_NO_SCRIPTS: 1
LANDO_NEEDS_EXEC: 1
<% } %>

Expand Down
21 changes: 21 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
## Changelog

### 3.3.0

* fix(dev-env): make sure wildcard subdomains work with SSL/TLS
* feat(dev-env): add XDebug information to `vip dev-env info --extended`

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.2.0...3.3.0

### 3.2.0

* feat(dev-env): make `domain` configurable
* build(deps): bump actions/dependency-review-action from 4.3.2 to 4.3.3
* build(deps-dev): bump the babel group with 4 updates
* Update the slowlogs command to follow the VIP-CLI styleguide
* feat(dev-env): add `--all` to `vip dev-env stop`
* chore: update lando to 77dad3a
* fix: CVE-2024-29415 in `socks`
* fix(dev-env): allow for unsetting media redirect domain
* fix(dev-env): validate version values

**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.1.0...3.2.0

### 3.1.0

* Integrate Media Import v2 flow and expand on media import error report messaging
Expand Down
Loading

0 comments on commit 2e708d5

Please sign in to comment.