Preview Environments
In this guide, you’ll learn how to configure preview environments for your Headless Platform sites.
What are preview environments?
To make your Headless Platform workflow easier, you can now dynamically create new environments to test your changes when you open a pull request (PR), without having to go through all the configuration steps in the User Portal.
If you decide to turn this feature on, every PR opened against the ‘source branch’ (the branch linked to your Headless Platform environment) will automatically create a preview environment - based on the code of the branch that is looking to merge into your source branch in the PR. Closing or merging the PR will shut the environment down.
This feature is available for all supported repository hosting service provider (GitHub, GitLab or Bitbucket).
Enable the ‘preview environments’ feature
This feature is enabled through a per-environment setting. Enable this setting by clicking on your Environment Details page’s lefthand submenu Settings
item, and toggling on the Preview Environments
setting:
Once you enable this feature via the toggle, every PR to the source branch for the environment will create a new preview environment automatically:
Create a preview environment
Once the setting is turned on, you can test the process by opening a pull request to the environment’s source branch.
When the preview environment is created, a comment will be posted, from the WP Engine bot, on the pull request page - this comment will include the new environment’s URL, build logs, and other details (GitHub example shown here):
In this comment you are provided with the status of the build, whether it succeeded or failed, and links directly to the build logs, the preview environment site, and access the preview environment’s details page (Portal).
You can also view all current preview environments for a given environment near the base of the Environment Details page, under the Preview environments
tab:
Delete a preview environment
The action of closing or merging the pull request will automatically shut the preview environment down.
You can also delete your preview environment through the User Portal - to do so, visit the preview environment details page and click the Delete
button.