Replies: 1 comment
-
Reason being, that Since It is probably a shopware problem that we are missing the proper tools to migrate plugins in a specific order, if that is at all possible without having dependency hell. Since this is not only a problem with deployments, but also with local mass updates of plugins or the update to a newer shopware versions, if you are using Everything inside is basically the same, but I added a wrapper for retries: $updatedPluginCount = 0;
$skippedPlugins = new EntityCollection();
$failSafe = $plugins->count() * 3; // Three times be a little excessive, but locally I have the "time"
do {
foreach ($plugins as $key => $plugin) {
try {
$this->pluginLifecycleService->updatePlugin($plugin, $context);
} catch (Exception $exception) {
$io->note(sprintf('Experienced error while updating plugin "%s" update. Defering. Error: %s', $plugin->getName(), $exception->getMessage()));
$skippedPlugins->set($key, $plugin);
continue;
}
++$updatedPluginCount;
$io->text(sprintf('Plugin "%s" has been updated successfully.', $plugin->getName()));
}
$plugins = $plugins->filter(fn(Entity $entity) => in_array($entity, $skippedPlugins->getElements()));
$skippedPlugins->clear();
$failSafe--;
} while (count($plugins) > 0 && $failSafe > 0);
if ($failSafe === 0) { // in this case we need to abort deployment with an error
$io->error('Something went seriously wrong, we hit the fail safe.');
}
if ($updatedPluginCount !== 0) {
$io->success(sprintf('Updated %d plugin(s).', $updatedPluginCount));
} (there is more plugin checks in there, but it is not important for the logic I am trying to convey). The output of the plugin update commands should be kept, so that the deployment log is a testament of the way the update process went. But the != 0 exit codes should not lead to an aborted deployment. I can not see any other viable option for this scenario, if you do not want to deploy EACH plugin update separately or define a update order (each time) you are deploying plugin updates. What do you guys think? |
Beta Was this translation helpful? Give feedback.
-
Deployer Version
v7.5.5
Target OS
22.04.5
Which PHP version are you using?
PHP 8.1
Content of deploy.php or deploy.yaml
There is basically nothing special in here. I just replaced the "no database" part on the build agent with one on the server, since Shopware 6.4 does not really support that setup properly. It always tries to connect to the database to find "all" plugins and gives out "connection issues" on the build agent.
Anyhow, this makes the deployment and the commands more reliable in this case, since everything it needs is available on the server for sure.
Steps to reproduce
dne/custom-css-js
in version2.0.3
andacris/tiny-mce
in version2.1.5
′ ¹dne/custom-css-js
to version3.0.1
andacris/tiny-mce
to2.1.9
sw:plugin:update:all
task (https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L117) runs. ²You should get an error messages along the lines of:
¹ Both of the extensions are payed ones, but those are the only ones I got right now.
dne_custom_js_css
has been open source before and should be available. I think this is easily reproducable with any plugin that comes alphabetically before the DNE one in theplugin:list
² I don't know if that is important, but i could be, because of caches and stuff. An update of
acris/checkout-voucher
beforeacris/tiny-mce
is actually successful. But that could also be related to it now having any frontend assets (css/js) in the version I am using.Beta Was this translation helpful? Give feedback.
All reactions