Repository navigation
Automatically run unknown commands in the web container - #3695
gilbertsoft wants to merge 2 commits into
Conversation
|
You'll want to rebase when you get back to this, thanks. |
|
Looking forward to seeing this see the light of day. The only issue is whether it can be predictable for people. How will help work? How will people know what anything does? |
|
Do you think this has a future @gilbertsoft ? It's nice, but the ambiguity of what to expect is a little troublesome. Easy enough to fix the test failure. |
|
Lets finish this one, will rebase later... |
756e4d7 to
4fd66a2
Compare
|
Download the artifacts for this pull request: |
|
Tested now and works like expected. I'm currently restarting the failing tests which don't have real issues... |
4fd66a2 to
7ef648e
Compare
|
It turns out that buildkite tests are run with Drupal6 by default, meaning that TestCustomCommands starts out with Drupal6. Then when the test changes the config type to php, it doesn't restart the container, meaning drush is still in there, so the test detects drush in that circumstance. At least I think this was the issue. I pushed b5b4f63 to try to fix this. |
|
@cmuench @jonaseberle Would love it if you could review this and try it out. It's a slick enhancement, my only concern is that it could cause confusion because of the undefined nature of commands in the future. |
There was a problem hiding this comment.
That works very well. Thank you @gilbertsoft!
I've tested with
ddev ssh (DDEV builtin)
ddev mysql (DDEV global command)
ddev dump-db live (DDEV custom command)
ddev vendor/bin/phpunit
ddev ls (command from $PATH)
ddev jq --help (check if parameter is appended to ddev or to the sub command)
ddev 'jq --help'
ddev 'source .env; echo $TYPO3_CONTEXT' (bash builtin)
ddev 'ls -als | grep public' && echo success || echo failed (pipes and exit codes)
ddev 'ls -als | grep nonexisting' && echo success || echo failed
|
I think it is conceptually in a tough spot: This feature works beautifully, but on the other hand it only saves the user from using My opinion: Having 2 ways for the same thing should generally be avoided. It makes it more difficult to show a coherent usage in docs/blog posts/support channels. Some will love it because they need to type 5 characters less, others will not use it in examples because they don't like ambiguity. I am quite sure a Twitter post about it would get generally good responses, too. |
|
Please see https://discord.com/channels/664580571770388500/950743021790576700 where this idea was born. I personally don't have a final opinion, it was just an idea to simlify things so I prepared this POC. Ongoing discussion is available here https://discord.com/channels/664580571770388500/972480296899448842. |
|
There are One dramatic option would be to put this on major-release track (v1.20) and at the same time remove the wrappers, like |
|
Yeah, removing existing custom commands sounds like a good idea. But this also removes them from the command list which was always a nice feature, but well, personally could live with that. We could introduce here sth like done for pull and push for the less experienced users to get a hint on project specific commands maybe... The $PATH should be set correctly as long as the user doesn't change the install structure. And if he does he also should take care of a proper $PATH override which I'm also doing for some special cases: |
|
We also can enhance the Because this really changes DDEV's behavior putting it into 1.20 sound also like a good idea! |
|
I'm sure we could shim in key commands into the help list without custom commands, so that's something to think about. |
Interesting thinking @gilbertsoft - However, exec is still used for other services (db, add-on, etc). But still worthy thinking. |
I guess sth like |
|
I'm still a little unsure about this change. There are pros and cons. If I type only "ddev", then we should see the command list. Then we have |
Since this may have been spun up as Drupal6 instance, and then only afterwards changed (in config) to php it may still have /usr/local/bin/drush linked, which will make ddev drush work
|
Rebased. |
|
My 2 cents -
update: I added an issue for that last piece #3881 |
|
@rfay well, my PoC here showed it would work. But like others I'm also not sure if we should merge it at this point. So I suggest to close this PR until a real issue pops up and get back on it if really needed.... |
|
I do think it is brilliant, but the fact that we lose control of the commands, and don't have a way to provide help, and it's pretty disruptive. But I think there might be a way to provide a small bit of help for the most important commands, not sure. But probably you're right. It certainly can't go in until I start on non-minor-release candidate work. |
|
Just make sure that it's not the only way to run commands. Because what if you have a bash command Still, consolidating |
|
I think we have a general consensus that we lose too much control of the user workflow with this approach. Closing. |
The Problem/Issue/Bug:
Currently to run a command in the web container a proper custom command has to be defined. It would be nice if unknown commands are just forwarded to the web container without the need of defining a custom command. If the command is not found it still can fail later.
How this PR Solves The Problem:
Unknown commands are simply forwarded to the web container and if found the exit code is properly returned.
If the command is not found an error is shown like it's done before.
Manual Testing Instructions:
ddev ls, the content ofvar/www/htmlshould be listedddev invalid, an error should be shownAutomated Testing Overview:
Related Issue Link(s):
Release/Deployment notes: