wpengine / github-action-wpe-site-deploy

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

Pipeline fails when `CACHE_CLEAR` is set to `true` #63

Closed claytoncollie closed 1 year ago

claytoncollie commented 1 year ago

I am using the latest version of this repository and when I set the CACHE_CLEAR flag to true I am met with a fatal error. When I set the flag to false I do not see the error and my pipeline completed properly.

Expected behavior

No errors should be presented.

Build Output & Screenshots

debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
debug1: channel 2: free: client-session, nchannels 3
debug1: channel 1: free: mux-control, nchannels 2

sent 390,829 bytes  received 140,797 bytes  30,378.63 bytes/sec
total size is 70,340,195  speedup is 132.31
OpenSSH_8.4p1, OpenSSL 1.1.1k  25 Mar [2021](https://github.com/PortlandArtMuseum/pam-website/actions/runs/3970482024/jobs/6806260078#step:6:2022)
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: multiplexing control connection
debug1: channel 1: new [mux-control]
debug1: channel 2: new [client-session]
debug1: Sending command: cd sites/pamdevelop  && wp --skip-plugins --skip-themes page-cache flush && wp --skip-plugins --skip-themes cdn-cache flush
debug1: mux_client_request_session: master session id: 2
PHP Fatal error:  Uncaught Error: Class "WpeCommon" not found in /usr/local/share/php/wpengine/ssh-wp-cli-package/src/wpengine/commands.php:22
Stack trace:
#0 [internal function]: wpengine\Page_Cache->flush()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(419): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(442): WP_CLI\Runner->run_command()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1256): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('...')
#11 /usr/local/bin/wp(4): include('...')
#12 {main}
  thrown in /usr/local/share/php/wpengine/ssh-wp-cli-package/src/wpengine/commands.php on line 22
Fatal error: Uncaught Error: Class "WpeCommon" not found in /usr/local/share/php/wpengine/ssh-wp-cli-package/src/wpengine/commands.php:22
Stack trace:
#0 [internal function]: wpengine\Page_Cache->flush()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(419): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(442): WP_CLI\Runner->run_command()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1256): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#10 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('...')
#11 /usr/local/bin/wp(4): include('...')
#12 {main}
  thrown in /usr/local/share/php/wpengine/ssh-wp-cli-package/src/wpengine/commands.php on line 22
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
debug1: channel 2: free: client-session, nchannels 3
debug1: channel 1: free: mux-control, nchannels 2

Version information

claytoncollie commented 1 year ago

Here is my config file

# https://github.com/marketplace/actions/deploy-wordpress-to-wp-engine

name: Deployment

on:
  workflow_call:
    inputs:
      install:
        required: true
        type: string
      script:
        required: true
        type: string
    secrets:
      WPE_SSHG_KEY_PRIVATE:
        required: true

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  stylelint:
    uses: ./.github/workflows/stylelint.yml

  eslint:
    uses: ./.github/workflows/eslint.yml

  phpcs:
    uses: ./.github/workflows/phpcs.yml

  phpstan:
    uses: ./.github/workflows/phpstan.yml

  deploy:
    name: Build and Deploy
    runs-on: ubuntu-latest
    needs: [stylelint,eslint,phpcs,phpstan]

    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version-file: '.nvmrc'

    - name: Build plugins and themes
      run: ${{ inputs.script }}

    - name: Deploy to WP Engine
      uses: wpengine/github-action-wpe-site-deploy@v3.2.2
      with:
        WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
        WPE_ENV: ${{ inputs.install }}
        SRC_PATH: "."
        REMOTE_PATH: "wp-content/"
        FLAGS: -azvr --inplace --delete --exclude=".*" --exclude-from=./deploy-scripts/rsync-excludes.txt
        CACHE_CLEAR: false

And then the file that kicks it off.

name: Deploy to Develop

on:
  push:
    branches:
    - develop

jobs:
  deploy:
    uses: ./.github/workflows/deployment.yml
    with:
      install: <removed client name>
      script: bash ./deploy-scripts/build-local-plugins-and-themes.sh
    secrets:
      WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
marksabbath commented 1 year ago

Hey @claytoncollie we've tried to reproduce the error in a fresh standard WordPress install with no success. I'd like to run a few test in the particular install that the error is happening, so would you mind reaching out WP Engine Support so we can ask you a few more questions related to the specific install that you're getting this error?

marksabbath commented 1 year ago

Hey @claytoncollie

It looks like you have a custom mu-plugins loader and it does not load WP Engine's default mu-plugins. The clear cache command that CACHE_CLEAR uses is based on classes defined in our mu-plugins and that's basically why it is failing and showing those errors.

claytoncollie-dmv commented 1 year ago

Thank you so much for looking into the install @marksabbath

I will adjust it accordingly.

Please close this issue.