Lullabot / drainpipe

GNU General Public License v3.0
33 stars 14 forks source link

task not being installed, dotenv.php missing from autoload-dev #175

Closed mrdavidburns closed 1 year ago

mrdavidburns commented 1 year ago

Seeing this error appear when running ddev composer install --no-cache after updating to 1.3.1

[Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files

In Filesystem.php line 254:

  /dev/null/files/lullabot/drainpipe/bin/task/3.18.0 does not exist and could not be created.

Note: this is happening on many, but not all, pull requests and builds on Tugboat. I have been able to replicate locally by running: ddev composer install --no-cache

possibly related: #172 and #165

quicksketch commented 1 year ago

I'm seeing this same problem on Evergreen. https://github.com/evergreenstatecollege/evergreen_preen/pull/47

mrdavidburns commented 1 year ago

If it's still there try removing vlucas/phpdotenv and update composer.json with the correct autoload from drainpipe README.md

quicksketch commented 1 year ago

A little more information: If you run ddev composer install --no-cache -vvv you can get a more detailed explanation of the failure:


Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:254
 Composer\Util\Filesystem->ensureDirectoryExists() at /var/www/html/vendor/lullabot/drainpipe/src/BinaryInstaller.php:200
 Lullabot\Drainpipe\BinaryInstaller->installBinary() at /var/www/html/vendor/lullabot/drainpipe/src/BinaryInstaller.php:168
 Lullabot\Drainpipe\BinaryInstaller->installBinaries() at /var/www/html/vendor/lullabot/drainpipe/src/BinaryInstaller.php:122
 Lullabot\Drainpipe\BinaryInstaller->onPostInstallCmd() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:200
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:123
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:374
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:144
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1028
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:370
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:138
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
 require() at /usr/local/bin/composer:29

In my debugging, it seems the problem comes from this line:

$cacheFolder = $this->cache->getRoot().$binary.\DIRECTORY_SEPARATOR.$version;

The returned value for $cacheFolder is /dev/null/files/lullabot/drainpipe/bin/task/3.18.0. Such a directory can never exist (within /dev/null), but I have no idea where it's getting that value.

quicksketch commented 1 year ago

If it's still there try removing vlucas/phpdotenv and update composer.json with the correct autoload from drainpipe README.md

Changing out the autoload-dev section for the one in the README fixes the [Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files message, but the fatal error still occurs.

Tracking down a bit further, it seems that the $this->cache->getRoot() value is set from the Composer cache-dir setting; which for some reason set to /dev/null?

Note also in my situation, I'm seeing this error on all Tugboat previews (in addition to locally when using --no-cache) when calling ./vendor/bin/task build:dev. This problem started for me when upgrading from the 1.2.16 version to 1.3.1 (but I confirmed it also occurs in 1.3.0).

deviantintegral commented 1 year ago

@mrdavidburns isn't sure this is a bug, but remind people if you're implementing drainpipe on an existing project you may need to rollback per-project changes for dotenv support.

mrdavidburns commented 1 year ago

I was able to work around this on the project where the error was occurring.

Added the following in composer.json

 "drupal/core-vendor-hardening": "^9.5.7",
    "config": {
        "vendor-dir": "vendor",
        ...
     }

Removed the following from composer.json

"drutiny/local-php-security-checker": true
    "autoload": {
        "files": ["load.environment.php"]
    },
mrdavidburns commented 1 year ago

Moving this to blocked.

Was able to fix this by resolving some composer issues. Not sure if this is actually a bug w/ Drainpipe or just an issue trying to integrate Drainpipe with composer configuration that seems to conflict with Drainpipe Scaffolding.

Should Drainpipe be able to fix itself when it runs into these issues? Should Drainpipe provide some helpful messages about what to look for to resolve the issues?

mrdavidburns commented 1 year ago

Leaving an update that I haven't seen this happen in a number of months and seems to be caused by adding drainpipe to a project that was already using phpdotenv. I'm okay if we were to close this and re-open or create a new one if it started happening again.

deviantintegral commented 1 year ago

Good thought! I just created a new Drupal project, required vlucas/phpdotenv, and then lullabot/drainpipe lullabot/drainpipe-dev. Everything worked fine, with the line 🪠 [Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files showing up as expected. Let's reopen this if it comes back.