-
Notifications
You must be signed in to change notification settings - Fork 53
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
Update DeployManager.php to hard fail on errors #27
base: 0.4.x
Are you sure you want to change the base?
Conversation
We had a project fail to composer install with the following error ``` PHP Warning: Uncaught Exception: Warning: require(/var/www/vhosts/example.com/staging/releases/1602858012/setup/config/application.config.php): failed to open stream: No such file or directory in /var/www/vhosts/example.com/staging/releases/1602858012/vendor/magento/framework/Console/Cli.php on line 78 in /var/www/vhosts/example.com/staging/releases/1602858012/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 /var/www/vhosts/example.com/staging/releases/1602858012/vendor/magento/framework/Console/Cli.php(78): Magento\Framework\App\ErrorHandler->handler(2, 'require(/var/ww...', '/var/www/vhosts...', 78, Array) #1 /var/www/vhosts/example.com/staging/releases/1602858012/vendor/magento/framework/Console/Cli.php(78): require() magento#2 /var/www/vhosts/example.com/staging/releases/1602858012/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI') magento#3 {main} thrown in /var/www/vhosts/example.com/staging/releases/1602858012/vendor/magento/framework/App/ErrorHandler.php on line 61 ``` When debugging i could see that a lot of the files from `magento/magento2-base` had not been copied over. I can see an error produced when running with `-vvv` ``` start magento deploy via deployManager start magento deploy for magento/magento2-base mkdir(): File exists start magento deploy for magento/magento2-base mkdir(): File exists start magento deploy for magento/magento2-ee-base jump over deployLibraries as no Magento libraryPath is set ``` I debugged and the issue was that previously on our NFS we had no `pub/media/import` but now we have had one created. Now when magento tried to `composer install` it was trying to copy over https://github.com/magento/magento2/blob/2.4-develop/pub/media/import/.htaccess, it faced this `File exists` error and stopped copying over the remainder of the files silently. I think `composer install` should fail loud and early in these scenarios, removing the error handling entirely allows the exception to bubble up. Any feedback appreciated
Aha, this might fix magento/magento2#10292 (comment) I think, which would be very nice! |
@hostep yeah this is the exact kind of error this will flag up and catch. |
Who maintains this repository? Can I have some feedback or a review? I think having |
Let me try to pull in @sidolov or @sivaschenko, it looks like community team sometimes focusses too much on https://github.com/magento/magento2 and forgets about all their other repositories 😉 |
Thanks @hostep I think this change is sensible, no matter what way I spin it I want errors in composer install to be loud and not silenced, as a silenced error is something i'll just have to debug. No one should be running If composer install is being run in some other circumstance and is being packaged before deployment, well then the live site is not affected by this change and the developer will have something to help them debug the error that is otherwise silent. |
@convenient @hostep thanks for the contribution and for reaching out, we will discuss this change, however, as we are processing PRs by priority it might require some time. |
These try-catch blocks have been introduced back in 2016 in the scope of internal task MAGETWO-48256 to fix magento/magento2#3056 Testing instructions from the internal ticket:
|
@sivaschenko thank you for digging those notes out. Wow, 2.0.1 references haha. Before I try and reproduce whatever ancient error that is, are zip based Magento installs actually supported or recommended anywhere ? I am on my phone but do not see any references to zip on https://devdocs.magento.com/guides/v2.4/install-gde/bk-install-guide.html |
They are available from here, so I guess they are still supported: https://magento.com/tech-resources/download |
Thanks @hostep I'm thinking that the original "fix" to suppress all errors was a bit of a sledgehammer approach and we need something a bit more nuanced. |
@sivaschenko I realistically don't have time to repro the zip install process. Would you accept a sledgehammer on a sledgehammer fix? Can I put in some additional options like in the extra like we have for That would be backwards compatible. |
@sivaschenko: any updates here? We lost about an hour of time today trying to debug a seemingly unrelated issue in our deploy. It turned out in the end that the Not sure if this PR would have made that more clear, and would have pointed our attention in the correct direction immediately, but it would be nice if this could get some attention again. So in case anything fails in the marshalling part of this composer plugin, we would like to see a very clear error message about what failed, and the Thanks! |
@hostep I think this change would have made it kick up some fuss, its definitely done that for file permission errors in media for us in the past so a full disk seems like the kind of thing. It's a bit annoying burning an hour or so and then finding it was this. I tried to do a composer patch to bring this in but this plugin was being triggered before the When I suspect a bug is an issue with this plugin my approach is a bit like the following, it allows you to hack in this file and then trigger the install process for all magento modules and see where it goes bang. # see my issue
composer install
# Move the magento-composer-installer out of the way
mv vendor/magento/magento-composer-installer/ magento-composer-installer
# Delete vendor magento install files
rm -rf vendor/magento
mkdir vendor/magento
# Put the magento-composer-installer back
mv magento-composer-installer vendor/magento/magento-composer-installer/
# put back in the hack to make exceptions noisy 🎉
nano vendor/magento/magento-composer-installer/src/MagentoHackathon/Composer/Magento/DeployManager.php
# Re-run composer install to trigger the error
composer install |
Hi @xmav, @karyna-tsymbal-atwix, @andrewbess: since you guys made significant changes to this plugin in the last couple of days and probably did a lot of testing, do you guys have an opinion here perhaps? (I want to try to use this momentum where a lot of people are working on this plugin to make it a bit more robust if possible 🙂) |
I think this would be the least impact change without me having to go back and regression test a weird install process. It would be opt in, but at least something |
@convenient Please change target branch to 0.4.x
|
sync with 0.4.x
Hey @xmav I'm not sure I can run these tests out of your ecosystem, like where do I find Prep
Running the tests
|
Hey @convenient Looks like I am getting same error with the tests as you do with this one. I've checked in with @sidolov and right now both of us have no idea how to approach this best. We will try to find someone who is more knowledgeable on this and get some insights. Sorry for the delay. |
let me know @ishakhsuvarov I couldnt even figure out how to composer patch this into my instances due to the ordering of the plugins being run, so there is currently no workaround that I know of other than pray bugs do not occur. |
Hi hope you're well @ishakhsuvarov @sidolov Any word on how to support / develop for this plugin ? Without the ability to run tests it seems tricky. Thanks |
This PR saved my life. Due to the |
Any update / ideas on how to handle this error suppressing issue? |
Any update / ideas on how to handle this error suppressing issue? I am unable to run the tests as per #27 (comment) |
Any update / ideas on how to handle this error suppressing issue? I am unable to run the tests as per #27 (comment) |
We had a project fail to composer install with the following error
When debugging i could see that a lot of the files from
magento/magento2-base
had not been copied over. I can see an error produced when running with-vvv
I debugged and the issue was that previously on our NFS we had no
pub/media/import
but now we have had one created.Now when magento tried to
composer install
it was trying to copy over https://github.com/magento/magento2/blob/2.4-develop/pub/media/import/.htaccess, it faced thisFile exists
error and stopped copying over the remainder of the files silently.I think
composer install
should fail loud and early in these scenarios, removing the error handling entirely allows the exception to bubble up.Any feedback appreciated