Repository navigation
Give each checkout its own wp-env containers - #1131
Merged
Merged
Conversation
The Makefile forced COMPOSE_PROJECT_NAME=wp-super-cache, so every checkout and worktree drove the same containers. make up in a worktree recreated them with the worktree's mounts, make destroy in one deleted the other's database, and plain wp-env commands couldn't see the containers make started. Let wp-env name the project after the checkout instead.
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.
The Makefile set
COMPOSE_PROJECT_NAME=wp-super-cacheon every wp-env call, so every checkout of the repo drove the same Docker containers. A review of the same setup in syntaxhighlighter (Automattic/syntaxhighlighter#322) caught it.make upin a git worktree recreated the shared containers with the worktree's files mounted, andmake destroyin either checkout deleted the other's database.npx wp-envcommands, without the variable, couldn't see the containers thatmakestarted.This drops the override, so wp-env names the containers after the checkout, which is its default. The
.wp-env.jsonmapping already puts the plugin atwp-content/plugins/wp-super-cache, so the hardcoded paths in the Makefile still work from a worktree.Before you pull this
Your existing containers are under the old
wp-super-cacheproject name, andmakewon't see them after this. They keep running on 8888, somake upwill fail on the port until you stop them:The new environment starts with a fresh database. If you want to keep the old site's content, export it with
COMPOSE_PROJECT_NAME=wp-super-cache npx wp-env run cli wp db exportfirst, then runCOMPOSE_PROJECT_NAME=wp-super-cache npx wp-env destroywhen you're done with it.Testing
I ran
WP_ENV_PORT=8894 WP_ENV_TESTS_PORT=8895 make test-integrationin a worktree while the main checkout's site was running. The worktree got its own containers, all 53 integration tests passed, and the main checkout's containers were left alone.