autoupgrade icon indicating copy to clipboard operation
autoupgrade copied to clipboard

Return exit code on unhandled exceptions, and allow process to go on when upgrading a module fails

Open Quetzacoalt91 opened this issue 1 year ago • 1 comments

:heavy_check_mark: Waiting for #727 to be merged first

Questions Answers
Description? We found out in some workflow, an exception not handled would still return the error code 0, allowing the next steps to be run. This PR makes sure a non-zero code is returned.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? /
Sponsor company @PrestaShopCorp
How to test? CI must be red if an issue is triggered by a module for instance.

PR contents:

  • Returns a non zero code when an exception is not handled
  • Remove html contents (displayed on CLI which is a non-sense)
  • Allow process to continue on error during updates
  • Display error details as warnings

Quetzacoalt91 avatar Jul 02 '24 16:07 Quetzacoalt91

The workflow UI Tests / UI Tests (1.7.8.11, 8.1.7, major, 7.4) (pull_request) now fails as expected

 INFO - === Step upgradeModules
INFO - 2 modules will be upgraded.
INFO - === Step upgradeModules
CRITICAL - [INTERNAL] /var/www/html/classes/Hook.php line 558 - PrestaShopModuleException: Hook with the name displayHeader has been registered by Ps_checkout, but the corresponding method hookDisplayHeader has not been defined in the Module class.
#0 /var/www/html/classes/module/Module.php(1061): HookCore::registerHook(Object(Ps_checkout), 'displayHeader', NULL)
#1 /var/www/html/modules/ps_checkout/upgrade/upgrade-8.3.3.0.php(41): ModuleCore->registerHook('displayHeader')
#2 /var/www/html/classes/module/Module.php(591): upgrade_module_8_3_3_0(Object(Ps_checkout))
#3 /var/www/html/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(268): ModuleCore->runUpgradeModule()
#4 /var/www/html/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(240): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->doUpgradeModule('ps_checkout')
#5 /var/www/html/modules/autoupgrade/classes/TaskRunner/Upgrade/UpgradeModules.php(79): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->upgradeModule(46347, 'ps_checkout', false)
#6 /var/www/html/modules/autoupgrade/classes/TaskRunner/ChainedTasks.php(55): PrestaShop\Module\AutoUpgrade\TaskRunner\Upgrade\UpgradeModules->run()
#7 /var/www/html/modules/autoupgrade/cli-upgrade.php(50): PrestaShop\Module\AutoUpgrade\TaskRunner\ChainedTasks->run()
#8 {main}
CRITICAL - [INTERNAL] /var/www/html/classes/Hook.php line 558 - PrestaShopModuleException: Hook with the name displayHeader has been registered by Ps_checkout, but the corresponding method hookDisplayHeader has not been defined in the Module class.
#0 /var/www/html/classes/module/Module.php(1061): HookCore::registerHook(Object(Ps_checkout), 'displayHeader', NULL)
#1 /var/www/html/modules/ps_checkout/upgrade/upgrade-8.3.3.0.php(41): ModuleCore->registerHook('displayHeader')
#2 /var/www/html/classes/module/Module.php(591): upgrade_module_8_3_3_0(Object(Ps_checkout))
#3 /var/www/html/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(268): ModuleCore->runUpgradeModule()
#4 /var/www/html/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(240): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->doUpgradeModule('ps_checkout')
#5 /var/www/html/modules/autoupgrade/classes/TaskRunner/Upgrade/UpgradeModules.php(79): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->upgradeModule(46347, 'ps_checkout', false)
#6 /var/www/html/modules/autoupgrade/classes/TaskRunner/ChainedTasks.php(55): PrestaShop\Module\AutoUpgrade\TaskRunner\Upgrade\UpgradeModules->run()
#7 /var/www/html/modules/autoupgrade/cli-upgrade.php(50): PrestaShop\Module\AutoUpgrade\TaskRunner\ChainedTasks->run()
#8 {main}
Error: Process completed with exit code 64.

Quetzacoalt91 avatar Jul 03 '24 07:07 Quetzacoalt91