wpengine / github-action-wpe-site-deploy

A GitHub Action to deploy code directly to WP Engine.
MIT License
173 stars 36 forks source link

Deploying with a source-controlled `mu-plugins` directory breaks multisite installations #91

Open ethanmay opened 3 months ago

ethanmay commented 3 months ago

Describe the bug Pushing files or folders to wp-content/mu-plugins deletes the mu-plugin.php file, which breaks multisite admin logins (as well as other WP Engine mu-plugins). It also attempts to delete WP Engine's mu-plugins but fails, including:

To reproduce

  1. Set up a WordPress repository to be deployed to the /wp-content directory.
  2. Ensure that your repository includes a functioning theme so it won't break the installation.
  3. Ensure that your repository includes the mu-plugins directory with at minimum a .gitkeep file in it. The repository should not include the WP Engine mu-plugins, as those should be controlled and updated by WP Engine and not checked in to source control.
  4. Set up the GitHub action to deploy to a WP Engine server in the /wp-content directory.
  5. Observe that the deployment action flags as Failed despite successfully deploying the files.
  6. Check the wp-content/mu-plugins directory on the server for mu-plugins.php and observe that it has been deleted.

Expected behavior

WP Engine's proprietary mu-plugins should not be impacted by deployment, regardless of the repository's contents.

Build Output & Screenshots

Deployment log from running trhe action with the above setup:

cannot delete non-empty directory: mu-plugins/wpengine-common/wp-cli
cannot delete non-empty directory: mu-plugins/wpengine-common/views/general
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main/tabs/staging
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main/tabs/site-settings
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main/tabs/information
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main/tabs/display
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main/tabs
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin/main
cannot delete non-empty directory: mu-plugins/wpengine-common/views/admin
cannot delete non-empty directory: mu-plugins/wpengine-common/views
cannot delete non-empty directory: mu-plugins/wpengine-common/js
cannot delete non-empty directory: mu-plugins/wpengine-common/images
cannot delete non-empty directory: mu-plugins/wpengine-common/css
cannot delete non-empty directory: mu-plugins/wpengine-common
cannot delete non-empty directory: mu-plugins/wpe-wp-sign-on-plugin/inc
cannot delete non-empty directory: mu-plugins/wpe-wp-sign-on-plugin
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/view
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/security
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/js/utils
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/js/services
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/js/dist
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/js/components
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/js
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin/css
cannot delete non-empty directory: mu-plugins/wpe-cache-plugin
cannot delete non-empty directory: mu-plugins/wp-cache-memcached/includes
cannot delete non-empty directory: mu-plugins/wp-cache-memcached
cannot delete non-empty directory: mu-plugins/force-strong-passwords/languages
cannot delete non-empty directory: mu-plugins/force-strong-passwords
deleting mu-plugins/mu-plugin.php

Version information

Additional context

Note that explicitly excluding these directories & that file solves the issue. It would be great if this could be implemented as the default rsync exclude list when using the action out of the box. At the very least, some documentation about how to properly set up the .deployignore should be created, as it caused a lot of problems for me when deploying to my multisite installation and took quite a few hours from both WP Engine support and my team to resolve.

Here's my .deployignore that fixed the issue:

mu-plugins/force-strong-passwords
mu-plugins/wp-cache-memcached
mu-plugins/wpe-cache-plugin
mu-plugins/wpe-wp-sign-on-plugin
mu-plugins/wpengine-common
mu-plugins/mu-plugin.php