Skip to content

Playground CLI: Wire up execution modes for Blueprints v2 #2519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: trunk
Choose a base branch
from

Conversation

brandonpayton
Copy link
Member

Motivation for the change, related issues

Without being able to use apply-to-existing-site mode with Blueprints v2, it is not practical to launch an existing site using Playground CLI and Blueprints v2. This is a PR to fix that.

Related to #2508

Implementation details

This PR:

  • Exposes a mode CLI option for use with Blueprints v2
  • Updates auto-mount logic to choose an appropriate Blueprints v2 mode depending on what is being auto-mounted

In the categories of bonus, controversial, and up for discussion, this PR also:

  • Expands the auto-mount option to allow passing an explicit path to auto-mount. If no path is passed the option defaults the current working directory. This is a nice feature IMO, and it also makes testing the CLI feature using npx nx unbuilt-jspi playground-cli (since the current directory for that command is typically the project root).

If desired we can split this change off into a separate PR, but I made the change here in order to make testing easier.

Testing Instructions (or ideally a Blueprint)

  • CI

@brandonpayton brandonpayton requested a review from a team August 16, 2025 02:48
@brandonpayton brandonpayton self-assigned this Aug 16, 2025
@brandonpayton brandonpayton added [Type] Bug An existing feature does not function as intended [Package][@wp-playground] CLI labels Aug 16, 2025
@brandonpayton
Copy link
Member Author

I adapted the existing run-cli tests to also test using --experimental-blueprints-v2-runner. The tests are not yet passing, but once we address the failures, we should have the same CLI test coverage for Blueprints v2 as we do for v1.

I'd also like to add more tests specific to Blueprints v2 as part of this PR.

* Playground should not modify the mounted directory.
*/
expect(await getDirectoryChecksum(tmpDir)).toBe(checksum);
expect(response.text).toContain('<title>My Blog Name</title>');
});

test('should be able to follow external symlinks in primary and secondary PHP instances', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was incorrectly included within the auto-mount tests, so this is just moving it where it belongs.

@brandonpayton
Copy link
Member Author

Observation:
These tests are timing out when on a slow connection. Maybe some of our test timeouts in CI are due to each test downloading a full copy of WordPress and sqlite-database-integration.

Maybe we should explore HTTPS caching during unit test.

@brandonpayton
Copy link
Member Author

Not all the pre-existing run-cli tests have to pass for this PR, but the remaining test failures are:

  • "should be able to follow external symlinks in primary and secondary PHP instances"
  • "should run a wp-content project using --auto-mount" -- Playground CLI complains that it cannot connect to the DB
  • "should run a wordpress project using --auto-mount" -- the blueprints v2 runner complains "The target site exists but WordPress is not properly installed or configured". This makes sense because it is mounting a freshly unzipped WordPress download.

For this PR to be merged, I believe the following need to be done:

  • Add a couple of Playground CLI Blueprints v2 tests for the manual --mode option in combination with --mount-before-install or --mount-dir-before-install.
  • Split the --auto-mount=<path> suggestion into its own PR.
  • Explicitly skip run-cli tests that are broken with the Blueprints v2 runner but not needed for this PR.

@brandonpayton
Copy link
Member Author

I did the following:

  • Split the --auto-mount=path suggestion into its own PR here: Playground CLI: Support --auto-mount=path option #2525
  • Explicitly skipped run-cli tests that are still failing under Blueprints v2.
  • Added --mode tests, but the one for apply-to-existing-site is failing with an HTTP redirect when we expect the homepage to be served with a 200 response.

It looks like the failing apply-to-existing-site test is all that remains to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] CLI [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant