Skip to content

Plugin installation fails for executeComposerCommands #42

@cngJo

Description

@cngJo

PHP Version

8.4

Shopware Version

6.7.6.2

Plugin Version


Actual behaviour

When the plugin base-class returns true for executeComposerCommands the installation fails in the container. This seems to be somehow related to shopware/conflicts.

I use the command from the readme to execute the tests which reproduces the error. I just changes the Shopware version and my TechnicalPluginName

docker run --rm -it -v "$PWD:/plugins/DemoPlugin" ghcr.io/friendsofshopware/platform-plugin-dev:v6.7.6 sh -c 'start-mysql && cd /plugins/DemoPlugin && phpunit'

Full logs:

Details
Starting mysql server
Started mysql server
Prepare installation

Drop database shopware_test
Created database shopware_test
Imported base schema.sql

Get collection for identifier: "core"
migrate Migrations
758/758 [============================] 100%


Action Number of migrations


Migrated 758 out of 758


all migrations for identifier: "core" executed
cleared the shopware cache

Get collection for identifier: "core"
migrate Migrations
758/758 [============================] 100%


Action Number of migrations


Migrated 758 out of 758


all migrations for identifier: "core" executed
cleared the shopware cache

Shop configured successfully

[sales_channel.indexer]
1/1 [============================] 100% < 1 ms/< 1 ms 123.0 MiB

[category.indexer]
1/1 [============================] 100% < 1 ms/< 1 ms 127.0 MiB

[media_folder_configuration.indexer]
12/12 [============================] 100% < 1 ms/< 1 ms 127.0 MiB

[media_folder.indexer]
12/12 [============================] 100% < 1 ms/< 1 ms 127.0 MiB

[rule.indexer]
3/3 [============================] 100% < 1 ms/< 1 ms 129.0 MiB

[flow.indexer]
32/32 [============================] 100% 1 s/1 s 129.0 MiB

[payment_method.indexer]
4/4 [============================] 100% < 1 ms/< 1 ms 129.0 MiB

Registering scheduled tasks ...
Done!

Shopware Plugin Service

[OK] Plugin list refreshed

Shopware Plugin Service


Plugin Label Composer name Version Upgrade version Author Installed Active Upgradeable Required by composer


DemoPlugin Skeleton plugin demo-plugin/demo-plugin 1.0.0 No No No No


1 plugins, 0 installed, 0 active , 0 upgradeable

Start theme compilation

[OK] User "admin" successfully created.

[OK] Sales channel has been created successfully.

Access tokens:
+------------+----------------------------+
| Key | Value |
+------------+----------------------------+
| Access key | SWSCMLIXRUHLVTLQTUXSVMDHUW |
+------------+----------------------------+

Copying assets

Copying files for bundle: FrameworkBundle
Copying files for bundle: MonologBundle
Copying files for bundle: TwigBundle
Copying files for bundle: Profiling
Copying files for bundle: DebugBundle
Copying files for bundle: Framework
Copying files for bundle: System
Copying files for bundle: Content
Copying files for bundle: Checkout
Copying files for bundle: DevOps
Copying files for bundle: Maintenance
Copying files for bundle: Administration
Copying files for bundle: PentatrionViteBundle
Copying files for bundle: Storefront
Copying files for bundle: Elasticsearch
Copying files for bundle: Service
Copying files for bundle: WebProfilerBundle
Copying files for bundle: StaticKernelPluginLoader
Copying files for bundle: Installer

[OK] Successfully copied all bundle files

// Clearing the cache for the test environment with debug true

[OK] Cache for the "test" environment (debug=true) was successfully cleared.

Shopware Plugin Service

[OK] Plugin list refreshed

Shopware Plugin Service


Plugin Label Composer name Version Upgrade version Author Installed Active Upgradeable Required by composer


DemoPlugin Skeleton plugin demo-plugin/demo-plugin 1.0.0 No No No No


1 plugins, 0 installed, 0 active , 0 upgradeable

Shopware Plugin Lifecycle Service

Install 1 plugin(s):

  • Skeleton plugin (v1.0.0)

PHPUnit 11.5.19 by Sebastian Bergmann and contributors.

Error in bootstrap script: Shopware\Core\Framework\Plugin\Exception\PluginComposerRequireException:
Could not execute "composer require" for plugin "DemoPlugin (demo-plugin/demo-plugin:1.0.0). Output:
Composer could not detect the root package (shopware/platform) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
./composer.json has been updated
Composer could not detect the root package (shopware/platform) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Running composer update demo-plugin/demo-plugin --with-dependencies

command: Bamarni\Composer\Bin\BamarniBinPlugin_composer_tmp6->onCommandEvent
[bamarni-bin] Calling onCommandEvent().
Loading composer repositories with package information
Updating dependencies
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires demo-plugin/demo-plugin 1.0.0 -> satisfiable by demo-plugin/demo-plugin[1.0.0].
- demo-plugin/demo-plugin 1.0.0 requires shopware/core ~6.7.0 -> found shopware/core[v6.7.0.0, v6.7.0.1, v6.7.1.0, v6.7.1.1, v6.7.1.2, v6.7.2.0, v6.7.2.1, v6.7.2.2, v6.7.3.0, v6.7.3.1, v6.7.4.0, v6.7.4.1, v6.7.4.2, v6.7.5.0, v6.7.5.1, v6.7.6.0, v6.7.6.1, v6.7.6.2, v6.7.7.0] but these were not loaded, likely because it conflicts with another require.
Problem 2
- shopware/conflicts is locked to version 0.6.0 and an update of this package was not requested.
- shopware/conflicts 0.6.0 requires shopware/core >=6.7.2.0 -> found shopware/core[v6.7.2.0, v6.7.2.1, v6.7.2.2, v6.7.3.0, v6.7.3.1, v6.7.4.0, v6.7.4.1, v6.7.4.2, v6.7.5.0, v6.7.5.1, v6.7.6.0, v6.7.6.1, v6.7.6.2, v6.7.7.0] but these were not loaded, likely because it conflicts with another require.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

#0 /opt/shopware/src/Core/Framework/Plugin/Composer/CommandExecutor.php(58): Shopware\Core\Framework\Plugin\PluginException::pluginComposerRequire('DemoPlugin', 'demo-plugin/dem...', 'Compos...')
#1 /opt/shopware/src/Core/Framework/Plugin/PluginLifecycleService.php(732): Shopware\Core\Framework\Plugin\Composer\CommandExecutor->require('demo-plugin/dem...', 'DemoPlugin')
#2 /opt/shopware/src/Core/Framework/Plugin/PluginLifecycleService.php(128): Shopware\Core\Framework\Plugin\PluginLifecycleService->executeComposerRequireWhenNeeded(Object(Shopware\Core\Framework\Plugin\PluginEntity), Object(DemoPlugin\DemoPlugin), '1.0.0', Object(Shopware\Core\Framework\Context))
#3 /opt/shopware/src/Core/Framework/Plugin/Command/Lifecycle/PluginInstallCommand.php(69): Shopware\Core\Framework\Plugin\PluginLifecycleService->installPlugin(Object(Shopware\Core\Framework\Plugin\PluginEntity), Object(Shopware\Core\Framework\Context))
#4 /opt/shopware/vendor/symfony/console/Command/Command.php(318): Shopware\Core\Framework\Plugin\Command\Lifecycle\PluginInstallCommand->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /opt/shopware/vendor/symfony/console/Application.php(1092): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /opt/shopware/vendor/symfony/framework-bundle/Console/Application.php(123): Symfony\Component\Console\Application->doRunCommand(Object(Shopware\Core\Framework\Plugin\Command\Lifecycle\PluginInstallCommand), Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /opt/shopware/vendor/symfony/console/Application.php(341): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Shopware\Core\Framework\Plugin\Command\Lifecycle\PluginInstallCommand), Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /opt/shopware/vendor/symfony/framework-bundle/Console/Application.php(77): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /opt/shopware/src/Core/TestBootstrapper.php(451): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /opt/shopware/src/Core/TestBootstrapper.php(72): Shopware\Core\TestBootstrapper->installPlugins()
#11 /plugins/DemoPlugin/tests/TestBootstrap.php(9): Shopware\Core\TestBootstrapper->bootstrap()
#12 /opt/shopware/vendor/phpunit/phpunit/src/TextUI/Application.php(358): include_once('/plugins/DemoPl...')
#13 /opt/shopware/vendor/phpunit/phpunit/src/TextUI/Application.php(121): PHPUnit\TextUI\Application->loadBootstrapScript('/plugins/DemoPl...')
#14 /opt/shopware/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#15 /opt/shopware/vendor/bin/phpunit(123): include('/opt/shopware/v...')
#16 {main}

Remaining self deprecation notices (4)

Remaining direct deprecation notices (36)

Remaining indirect deprecation notices (3)

The relevant section is at the bottom:

Problem 1

- Root composer.json requires demo-plugin/demo-plugin 1.0.0 -> satisfiable by demo-plugin/demo-plugin[1.0.0].

- demo-plugin/demo-plugin 1.0.0 requires shopware/core ~6.7.0 -> found shopware/core[v6.7.0.0, v6.7.0.1, v6.7.1.0, v6.7.1.1, v6.7.1.2, v6.7.2.0, v6.7.2.1, v6.7.2.2, v6.7.3.0, v6.7.3.1, v6.7.4.0, v6.7.4.1, v6.7.4.2, v6.7.5.0, v6.7.5.1, v6.7.6.0, v6.7.6.1, v6.7.6.2, v6.7.7.0] but these were not loaded, likely because it conflicts with another require.

Problem 2

- shopware/conflicts is locked to version 0.6.0 and an update of this package was not requested.

- shopware/conflicts 0.6.0 requires shopware/core >=6.7.2.0 -> found shopware/core[v6.7.2.0, v6.7.2.1, v6.7.2.2, v6.7.3.0, v6.7.3.1, v6.7.4.0, v6.7.4.1, v6.7.4.2, v6.7.5.0, v6.7.5.1, v6.7.6.0, v6.7.6.1, v6.7.6.2, v6.7.7.0] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Expected behaviour

Tests should still be executed when executeComposerCommands is requested by the PluginBaseClass.

Steps to Reproduce?

git clone git@github.com:cngJo/DemoPlugin-Reproduction.git
cd DemoPlugin-Reproduction
docker run --rm -it -v "$PWD:/plugins/DemoPlugin" ghcr.io/friendsofshopware/platform-plugin-dev:v6.7.6 sh -c 'start-mysql && cd /plugins/DemoPlugin && phpunit'

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions