terminus icon indicating copy to clipboard operation
terminus copied to clipboard

env:deploy command not clearing cache or running database updates.

Open chrisgross opened this issue 8 years ago • 13 comments

Expected behavior

When I use the env:deploy command, with --cc and --updatedb flags, the remote caches should clear and database updates should run.

Actual behavior

The caches are not being cleared after deployment, nor are database updates running

Steps to reproduce the behavior

terminus -y env:deploy --cc --updatedb --note="Deployed via Terminus" -- "$SITE"."$COMMAND"

chrisgross avatar Jun 26 '17 19:06 chrisgross

I don't have any pending db updates to test this. I was always suspicious that the cache clearing didn't work, but didn't have technical proof.

If the issue you described is indeed happening, it could cause major problems (particularly the failure to update the DB) for anyone using terminus deployment in production, which I am.

Can one of the terminus contributors chime in on this?

arderyp avatar Jul 19 '17 16:07 arderyp

Just to update, I can confirm that this has happened repeatedly since I reported the issue. I have had to resort to using terminus drush to manually clear caches and run updates after each deployment. I don't know how long this problem has existed (I knew it hasn't always happened), but countless clients may have pending database updates and not know it. Very bad.

chrisgross avatar Jul 19 '17 16:07 chrisgross

I've also been using terminus drush <SITE>.<ENV> -- cc all to clear cache after running the deployment command. Is the database update command you are using terminus drush <SITE>.<ENV> -- updatedb?

arderyp avatar Jul 19 '17 16:07 arderyp

That's the one.

chrisgross avatar Jul 19 '17 16:07 chrisgross

thanks. Hopefully this issue will be fixed, thanks for opening it.

arderyp avatar Jul 19 '17 16:07 arderyp

So, upon troubleshooting why the --accept-upstream does not seem to actually resolve conflicts, I discovered that this command, alone with --updatedb and --cc, now require additional, completely redundant arguments or they will not work. So you now have to type --updatedb UPDATEDB, --cc CC, --accept-upstream ACCEPT-UPSTREAM, which seems unnecessary, confusing, and ridiculous. Why?

chrisgross avatar Jul 31 '17 19:07 chrisgross

Also https://pantheon.io/docs/terminus/commands and https://pantheon.io/docs/terminus/examples/ are inaccurate in this regard. The output from terminus itself does not make this very clear, either.

chrisgross avatar Jul 31 '17 20:07 chrisgross

thanks for the info @chrisgross. Hopefully someone from Pantheon will chime in soon, since people realying on these arguments without knowing that they don't do anything could run into major headaches (particularly regarding unexecuted migrations)...

arderyp avatar Aug 01 '17 00:08 arderyp

@chrisgross @arderyp I've been unable to duplicate your findings. I am also unable to disern how --updatedb UPDATEDB --cc CC --accept-upstream ACCEPT-UPSTREAM would work; when I attempted to use this format, Terminus simply erred for too many command arguments. Indeed, these options all default to false unless they are present which will produce true, then whatever is fed in through the option (if even you were to use --updatedb=UPDATEDB --cc=CC --accept-upstream=ACCEPT-UPSTREAM), the values you've added are completely thrown away and a 0 or 1 (or nonzero, which has the same effect) is sent to the API (which is done here: https://github.com/pantheon-systems/terminus/blob/master/src/Commands/Env/DeployCommand.php#L56-L59).

Are you able to affect the desired changes in deploys via the Dashboard?

TeslaDethray avatar Aug 28 '17 21:08 TeslaDethray

I am not sure about the redundant ACCEPT-UPSTREAM and UPDATEDB arguments that @chrisgross mentioned. The code I am looking at doesn't seem to suggest that said problem exists, but I may be missing something.

@chrisgross can you confirm that --updatedb and --accept-upstream are not working on the latest terminus release? If I have time to spin up some test environments to test this out, I will and I'll report back.

arderyp avatar Aug 29 '17 01:08 arderyp

I just confirmed that --updateb and -cc do not work properly without additional arguments in terminus 1.5.1-dev. I cannot currently test --accept-upstream, but I presume it does not work, either. It makes sense that a text argument like ACCEPT-UPSTREAM would work because it probably resolves to TRUE. So, it turns out that passing 1 as an argument is sufficient, but that's not clear at all from the documentation online (which suggests no additional arguments are needed) or in the application (which suggests the use of text argument, not a boolean).

This finding was just been reproduced and confirmed on several of my sites. The command I was trying to use without arguments was terminus -y env:deploy --cc --updatedb --note="Deployed via Terminus" -- site.env. This resulted in no caches being cleared, nor db updates performed. The command terminus -y env:deploy --cc 1 --updatedb 1 --note="Deployed via Terminus" -- site.env did work.

chrisgross avatar Sep 08 '17 22:09 chrisgross

thanks for the info @chrisgross!

arderyp avatar Sep 12 '17 05:09 arderyp

This is still an issue in 2025. After upgrading to WordPress 6.7.1, I ran terminus env:deploy --updatedb -- [site].[env]. The DB was not upgraded, and I was met with the "Database Update Required" message.

When I run terminus remote:wp [site].[env] -- core update-db, the message goes away.

edit:

The suggested workaround from 2017 no longer works:

$ terminus env:deploy --updatedb 1 -- [site].test 

  Too many arguments to "env:deploy" command, expected arguments "site_env".

env:deploy [--sync-content] [--note [NOTE]] [--cc] [--updatedb] [--] <site_env>

$ terminus env:deploy --updatedb=1 -- [site].test

  The "--updatedb" option does not accept a value.

env:deploy [--sync-content] [--note [NOTE]] [--cc] [--updatedb] [--] <site_env>

blakeashleyjr avatar Feb 06 '25 22:02 blakeashleyjr