DataDog / dd-trace-php

Datadog PHP Clients
https://docs.datadoghq.com/tracing/setup/php
Other
497 stars 155 forks source link

Update containers to use Composer 2.0 #1063

Closed morrisonlevi closed 11 months ago

morrisonlevi commented 4 years ago

I recommend updating our testing containers to use the newer composer version. It's compatible all the way back to PHP 5.3, so we're safe on that front.

The main motivation is that it is significantly faster, and slow updates/installs are annoying. This should help us out quite a bit. For instance, look at the speed up of common installations:

Performance improvements of Composer 2.0 compared to 1.0 on Drupal, Laravel, and Symfony Taken from https://blog.packagist.com/composer-2-0-is-now-available/#performance-improvements.

I recommend a phased roll-out in case we encounter issues.

morrisonlevi commented 4 years ago

I've identified two issues so far:

  1. symfony/flex needs to be updated to 1.9.8+. This one is trivial and obvious; expect a PR for it.
  2. Symfony 2.3 has this issue:

    Fatal error: Uncaught TypeError: Argument 1 passed to Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap() must be an instance of Composer\Script\CommandEvent, instance of Composer\Script\Event given, called in phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php on line 323 and defined in /home/circleci/datadog/tests/Frameworks/Symfony/Version_2_3/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:33 Stack trace:

    0 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(323): Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap(Object(Composer\Script\Event))

    1 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(219): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript('Sensio\Bundle\D...', 'buildBootstrap', Object(Composer\Script\Event))

    2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(101): Composer\EventDispatc in /home/circleci/datadog/tests/Frameworks/Symfony/Version_2_3/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php on line 33

    Makefile:593: recipe for target 'test_web_symfony_23' failed

The Sensio distribution bundle has been abandoned, so unless this can be fixed via a composer update then we can't use composer 2 when running Symfony 2.3 tests. Symfony 2.3 was an LTS release that reached EOL in May 2017.

If Symfony 2.3 ends up being literally only one that can't use Composer 2 then I think we should consider dropping it from the test suite.

SammyK commented 4 years ago

I'm 👍 for removing Symfony 2.3 from the test suite to allow more momentum on actively supported software.

morrisonlevi commented 4 years ago

Looks like it was fixable via an update: https://github.com/DataDog/dd-trace-php/pull/1075. After we've released 0.50 do you think you could help me get all the composer 2 changes over the finish line?

labbati commented 3 years ago

@morrisonlevi what's the work on this? I think we completed the migration or we still have work to do?

morrisonlevi commented 3 years ago

Here's what I remember:

  1. Tried upgrading to composer 2 in some CI jobs, went fine, so moved on to point 2.
  2. Upgraded it in containers. A bunch of things broke in CI. Downgraded the containers.
  3. Opened PR #1075, which added self-update to more CI jobs, fixed some Symfony stuff specifically.

All has been well since, I think. This probably means that we're good to try upgrading composer in containers the next time we are working on them (or want to prioritize it).

labbati commented 3 years ago

Thanks @morrisonlevi