terminus
terminus copied to clipboard
env:deploy command not clearing cache or running database updates.
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"
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?
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.
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?
That's the one.
thanks. Hopefully this issue will be fixed, thanks for opening it.
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?
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.
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)...
@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?
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.
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.
thanks for the info @chrisgross!
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>