-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --skip-hooks
flag for ddev start, restart, etc.
#2129
Comments
Makes sense. We may be able to come up with a more elegant solution as we think about it. But I find hooks that execute when I don't need them annoying, so this might be a good path. |
--skip-config-hooks
flag for ddev (re)start--skip-hooks
flag for ddev start, restart, etc.
I would also love to have the possibility to skip the pre and post start hooks. 3 flags would be nice and cover all needs imho:
|
How about just --skip-hooks, global ? The more stuff we add, the harder it is for everybody to understand. And of course... people can just comment out the hooks. @amitaibu The easier thing for what you're doing is to make the hook smart enough to do what's needed. For example, load a db if needed, run composer install if needed, etc. Like this one |
Just thought about this and found this issue! @rfay I think adding a global I often manually disable the hooks to save time when I restart the project and know that the hooks don't need to run (especially when restoring a database snapshot). |
Having the ability to skip hooks is something we would like to have. In my situation we use "ddev import-db --src=db.sql" to import db BEFORE running 'ddev start -y'. But we see from the logs that ddev import-db triggers the post-start hook and ends with error. We need to run ddev import-db without triggering hooks. Thanks |
Of course, you can make your hooks less fragile. In your case @karpa you could check for existence of db before running hooks, as in https://github.com/drud/ddev-contrib/tree/master/hook-examples/import-db-if-empty |
Thanks for pointing out the possible workaround @rfay! Actually we have made a similar workaround ourselves (based on our app configuration). But having the proposed solution of this issue would be better. |
+1 for this feature. I could use this for disabling post-import-db hooks. |
+1 I could use this very much. @rfay did you have a start-commit already somewhere? I want to contribute a start for the feature somewhere this weekend |
@MakerTim I think the first thing to think about is whether you could make your hook less fragile. Could you test for whether it's already sanitized? Could you use an environment variable or something to control it? I'm afraid something like And +1 for doing the sanitization! Doing it upstream would be more robust and less prone to failure though... |
+1 for global my use case would be to do an initial database import without our organization-wide default pre-import-db hook which executes a ddev snapshot: |
+1 for global --skip-hooks |
1 similar comment
+1 for global --skip-hooks |
I now use My usecase lately is to sync pre-production to production. and backwards when the customer wants to do a lot of changes at once. They do a content stop on production and do everything to a pre-production. |
You might want to put the hooks in a
I assume you're talking about some database processing you're doing, in which case you could make a smarter hook that respected an environment variable or whatever. |
Is your feature request related to a problem? Please describe.
My goal is to always have my commands executed under DDEV. So for example I don't want to run
composer install
, but insteadddev composer install
. To do so I need my project to be started.However, I often have my
config.local.yaml
defined withpost-start
hook that willdrush site-install
. So what happens is, on first install, it will start the container, try to install (and fail because composer didn't run yet), and then it willcomposer install
.I was able to workaround it, with some trickery. Specifically:
Describe the solution you'd like
Instead of this late copy, or having to delete the
config.local.yaml
, it could be convenient to do something like:The text was updated successfully, but these errors were encountered: