Lullabot / drainpipe

GNU General Public License v3.0
30 stars 14 forks source link

Fix Pantheon deploy error #616

Closed mrdavidburns closed 1 month ago

mrdavidburns commented 1 month ago

Relates to: #601

Pantheon DEV deploy still failing on update step with v3.8.1 Looks like the update command runs but it reports back as failed.

Failed to execute command ./vendor/bin/task -l | grep '* update: ': exit status 1
[drupal:update]  [success] No pending updates.
[drupal:update]  [success] Cache rebuild complete.
Notice: [drupal:update]  [notice] There are no changes to import.
Notice: [drupal:update]  [notice] There are no changes to import.
[drupal:update]  [success] Cache rebuild complete.
[drupal:update]  [success] No pending deploy hooks.
[drupal:update] Config export does not match database.
Notice: [drupal:update]  [notice] No differences between DB and sync directory.
task: Failed to run task "drupal:update": exit status 1
Failed to execute command ./vendor/bin/task drupal:update site=@***.pr-3836: exit status 201
Error: Process completed with exit code 1.
mrdavidburns commented 1 month ago

Making note that this may be caused by a change from Pantheon. The DEV deploy actions worked fine and did not change for a few projects then suddenly started having these types of errors.

vordude commented 1 month ago

Hi Matt,

Arvin here, with the Customer Success team at Pantheon.

We've received your issue and the team was able to look into it. With the logs that you provided, we may need further clarification to help us understand what's happening in these GitHub actions from the logs and what the problem is with the site.

Mainly on this log here:

Notice: .yml does not contain an "update" task and will fall back to using "task drupal:update". [notice] Fetching site information to build Drush aliases...Notice: ] 1 sites found.Notice: ] Writing Drush 8 alias file to ~/.drush/pantheon.aliases.drushrc.phpNotice: ] Writing Drush 9 alias files to ~/.drush/sites/pantheon[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] [success] No pending updates.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] [success] Cache rebuild complete.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] +------------+--------------------------+-----------+[drupal:update] | Collection | Config | Operation |[drupal:update] +------------+--------------------------+-----------+[drupal:update] | | user.role.writer | Update |[drupal:update] | | user.role.publisher | Update |[drupal:update] | | user.role.editor | Update |[drupal:update] | | user.role.agency_manager | Update |[drupal:update] +------------+--------------------------+-----------+[drupal:update] [drupal:update] // Import the listed configuration changes?: yes. [drupal:update] Notice: [drupal:update] [notice] Synchronized configuration: update user.role.writer.Notice: [drupal:update] [notice] Synchronized configuration: update user.role.publisher.Notice: [drupal:update] [notice] Synchronized configuration: update user.role.editor.Notice: [drupal:update] [notice] Synchronized configuration: update user.role.agency_manager.Notice: [drupal:update] [notice] Finalizing configuration synchronization.[drupal:update] [success] The configuration was imported successfully.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).Notice: [drupal:update] [notice] There are no changes to import.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] [success] Cache rebuild complete.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] [success] No pending deploy hooks.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).[drupal:update] Config export does not match database.[drupal:update] > Failed to add the host to the list of known hosts (/home/.ssh-agent/known_hosts).Notice: [drupal:update] [notice] No differences between DB and sync directory.task: Failed to run task "drupal:update": exit status 1Failed to run task drupal:update site=@[project-name].dev: exit status 201Error: Process completed with exit code 1. It looks like this section of logs is showing it runs a task called drupal:update. There are repeated warnings that it Failed to add the host to the list of known hosts, but based on some of the previous tickets, mostly they are warnings and not an errors entirely.

It looks like most of the steps are succeeding, but then it returns Failed to run task "drupal:update": exit status 1. I'm not sure what this line means: [drupal:update] Config export does not match database.

I think that there might be changes with the config to cause the error message. Are there any error messages in the Dev environment after that specific deployment?

Looking forward to your response on this.

Regards, Arvin G. Customer Success Engineer Pantheon Systems, Inc.

mrdavidburns commented 1 month ago

Confirming that we're not showing any config differences after code has been deployed and post-deploy steps have run.

terminus drush [project-name].dev -- cst
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
 [notice] No differences between DB and sync directory.
 [notice] Command: lullabot8.dev -- drush cst [Exit: 0] (Attempt 1/1)

Also unable to replicate the error on DDEV (local) and Tugboat.

mrdavidburns commented 1 month ago

I haven't been able to replicate this locally but I suspect it's when we're running the config:status check that expects json to be returned.

  update:
    desc: Run Drupal update tasks after deploying new code
    cmds:
      # See https://www.drush.org/12.x/deploycommand/
      - ./vendor/bin/drush {{.site}} --yes updatedb --no-cache-clear
      - ./vendor/bin/drush {{.site}} --yes cache:rebuild
      # Run config:import twice to make sure we catch any config that didn't declare
      # a dependency correctly. This is also useful when importing large config sets
      # as it can sometimes hit an out of memory error.
      - ./vendor/bin/drush {{.site}} --yes config:import || true
      - ./vendor/bin/drush {{.site}} --yes config:import
      - ./vendor/bin/drush {{.site}} --yes cache:rebuild
      - ./vendor/bin/drush {{.site}} --yes deploy:hook
      - |
        if [[ $(./vendor/bin/drush {{.site}} config:status --format=json --state=Different) != '[]' ]]; then
          echo "Config export does not match database."
          ./vendor/bin/drush {{.site}} config:status
          exit 1;
        fi
      # Run cron after updating to refresh items.
      - ./vendor/bin/drush {{ .site }} core:cron --verbose 
mrdavidburns commented 1 month ago

All environments seem to be running the same version of Drush. DDEV: Drush version : 12.5.2.0 Tugboat: Drush version : 12.5.2.0 Pantheon: Drush version : 12.5.2.0

mrdavidburns commented 1 month ago

DDEV and Pantheon are returning [] for the config:status check.

DDEV:

ddev drush config:status --format=json --state=Different
 [notice] No differences between DB and sync directory.
[]

Pantheon:

terminus drush lullabot8.dev -- config:status --format=json --state=Different
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
 [notice] No differences between DB and sync directory.
[]
deviantintegral commented 1 month ago

@mrdavidburns can you check to see if the notice is coming on stdout? If so, I wonder if we need to add some flag to drush to suppress that. This kind of feels like a drush bug to me - "--format=json returns output that is not valid json".