Bitbucket Pipe for WP Engine Site Deployments
If you need to deploy WordPress code from a Bitbucket repo to WP Engine, use our WP Engine Bitbucket Pipe. Deploy a full site directory or any sub-directory with the SRC_PATH and REMOTE_PATH options. Other options include performing a PHP Lint, custom rsync flags, or clearing cache.
This configuration uses WP Engine’s SSH Gateway, instead of WP Engine’s GitPush feature.
Configuration requires three main steps: Save a private SSH Key to Bitbucket, save a public SSH key to WP Engine, and set up
bitbucket-pipelines.yml to orchestrate the deploy.
STEP 1: SSH PRIVATE KEY SETUP IN BITBUCKET
- Generate a new SSH key pair, if you have not already done so.
- Add the base64 SSH Private Key to your Repository Variables or your Workspace variables.
- Note: Bitbucket requires base64 encoding to store keys. This guide will outline how to copy in the proper format
- Save the new secret “Name” as
STEP 2: SSH PUBLIC KEY SETUP IN WP ENGINE
- Add the SSH Public Key to your WP Engine SSH Gateway Key settings. This Guide will show you how.
STEP 3: YML SETUP
- Create a
bitbucket-pipelines.ymlfile in the root of your repo locally. Copy and paste the configuration from below, replacing the value under
branches:and the value for
- To configure deploy for another branch, the
bitbucket-pipelines.ymlcan be extended with an additional workflow. See below example for details.
This provides the ability to perform a different workflow for different branches/environments. Consult “Bitbucket Branch Workflows” for available options.
STEP 4: GIT PUSH YOUR SITE TO THE BITBUCKET REPO
The action will do the rest!
View your pipelines progress and logs by navigating to the “Pipelines” tab in your repository.
Example Bitbucket Pipeline Workflow
Copy and paste a configuration from below, replacing the value under
branches: and the value for
pipelines: branches: main: - step: name: Deploy to Production script: - pipe: wpengine/wpe-site-deploy:v1 variables: WPE_SSHG_KEY_PRIVATE: $WPE_SSHG_KEY_PRIVATE WPE_ENV: '<sitename>'
Extended Sample bitbucket-pipelines.yml:
pipelines: branches: main: - step: name: Deploy to Production script: - pipe: wpengine/wpe-site-deploy:v1 variables: WPE_SSHG_KEY_PRIVATE: $WPE_SSHG_KEY_PRIVATE WPE_ENV: '<sitename>' staging: - step: name: Deploy to Staging deployment: staging script: - pipe: wpengine/wpe-site-deploy:v1 variables: WPE_SSHG_KEY_PRIVATE: $WPE_SSHG_KEY_PRIVATE WPE_ENV: '<sitename>'
Environment Variables and Secrets
|secrets||Base64 encoded Private SSH Key for the SSH Gateway and deployment. See below for SSH key usage.|
|string||Insert the name of the WP Engine environment you want to deploy to.|
|string||Optional path to specify a directory within the repo to deploy from. Ex. |
|string||Optional path to specify a directory destination to deploy to. Ex. |
|bool||Set to TRUE to execute a php lint on your branch pre-deployment. Default is |
|string||Set optional rsync flags such as |
Caution: Setting custom rsync flags replaces the default flags provided by this pipe. Consider also adding the
|string||Remote bash file to execute post-deploy. This can include WP_CLI commands for example. Path is relative to the WP root and file executes on remote. This file can be included in your repo, or be a persistent file that lives on your server.|
|bool||Optionally clear page and CDN cache post deploy. This takes a few seconds. Default is |