renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.19k stars 2.25k forks source link

Master issue rebase using global composer hanging #2625

Closed Jamesking56 closed 5 years ago

Jamesking56 commented 5 years ago

What Renovate type are you using? Renovate Docker + GitLab CI

Describe the bug Renovate master issue rebase hanging when trying to use global composer.

Did you see anything helpful in debug logs?

 INFO: Branch has been checked in master issue: rebase (repository=<repo>, dependencies=doctrine/inflector, branch=renovate/doctrine-inflector-1.x)
 INFO: Branch renovate/doctrine-inflector-1.x is approved for creation (repository=<repo>, dependencies=doctrine/inflector, branch=renovate/doctrine-inflector-1.x)
 INFO: Manual rebase requested via master issue (repository=<repo>, dependencies=doctrine/inflector, branch=renovate/doctrine-inflector-1.x)
 INFO: Running composer via global composer (repository=<repo>, dependencies=doctrine/inflector, branch=renovate/doctrine-inflector-1.x)

To Reproduce Steps to reproduce the behavior:

  1. Create repository with master issue setting with an outdated composer dep
  2. Run renovate
  3. Make a change in master making sure your branch needs a rebase
  4. Tick to ask renovate to rebase branch in master issue
  5. Run renovate again

Expected behavior Rebase the requested branch

Additional context I can provide access to repos if needed.

rarkins commented 5 years ago

If you kill Renovate and try again, does it hang the next time too?

Jamesking56 commented 5 years ago

Yeah, my CI actually times out after 30 minutes killing it anyway, but does this on every run.

rarkins commented 5 years ago

Can you run the same Renovate command locally, pointing to the same repo? Ie take the CI out of the equation

Jamesking56 commented 5 years ago

Running the exact commands my CI runs on my local machine yields the exact same result (thanks to Docker), its hanging on my local machine also.

Commands are:

docker pull renovate/renovate
docker run renovate/renovate --platform gitlab --timezone Europe/London --token $RENOVATE_TOKEN --autodiscover

The repo it gets to has this config:

{
    "extends": [
        "config:base",
        ":prNotPending",
        ":automergeDigest",
        ":automergePatch",
        ":pinSkipCi",
        ":masterIssueApproval",
        ":assignAndReview(Jamesking56)"
    ],
    "ignoreDeps": ["laravel/*"]
}
rarkins commented 5 years ago

Do you have compose and Node.js installed locally? I'm interested to know if it also fails when run in non-Docker, e.g. installed via npm i -g renovate and run using renovate --platform gitlab --timezone Europe/London --token $RENOVATE_TOKEN --autodiscover.

Jamesking56 commented 5 years ago

Same thing is happening running the NPM version for me as well. I think its something to do with the repo, maybe a composer error?

rarkins commented 5 years ago

Originally my best guess was that it was a cache problem, and then a Docker problem, but your tests seem to eliminate both those. Now my best guess - and apparently my guessing is not too accurate today - is that compose is perhaps hanging asking for some type of confirmation or interaction. Maybe we should be adding this to the command?

--no-interaction (-n): Do not ask any interactive question.

It would be after --no-ansi.

Jamesking56 commented 5 years ago

Just tried the composer command manually in my repo on my machine, and it worked fine composer update doctrine/inflector --ignore-platform-reqs --no-ansi

Not sure why its hanging then...?

Jamesking56 commented 5 years ago

We should add --no-interaction anyway regardless of this bug, it should always be added for scripting

Jamesking56 commented 5 years ago

OK, dug a bit deeper on this. Just cloned this repo and ran it and it worked... I'm not really sure what is different between your released renovate and master though

rarkins commented 5 years ago

We release every commit to master and there's no build step, so it should be close to identical. Certainly I can't think what difference there would be with composer.

Jamesking56 commented 5 years ago

Now its managed to rebase, its added a comment saying there is an issue with composer.lock in my repo with this:

...
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Writing lock file
Generating autoload files

In ClassMapGenerator.php line 69:

  Could not scan for classes inside "database" which does not appear to be a   
  file nor a folder                                                            

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

 `composer update doctrine/inflector --ignore-platform-reqs --no-ansi` (exited with error code 1)

The database directory exists in my project and should always be there (its a Laravel project). Not sure why its missing in this case.

rarkins commented 5 years ago

Because when we write files for getArtifacts(), we don't copy every file in the repo. Would this be being called via scripts in composers.json ?

Jamesking56 commented 5 years ago

Yeah, we need to add --no-scripts to stop the scripts running then or pull all files

rarkins commented 5 years ago

Does it run OK when you run it locally with that addition?

Jamesking56 commented 5 years ago

Just running now, just told renovate to rebase it to see

Jamesking56 commented 5 years ago

Doesn't work with --no-scripts, same error. I think the classmap stuff is composer's autoloader looking for the directory. Here is my composer.json:

{
    "name": "REDACTED",
    "description": "REDACTED",
    "keywords": [],
    "license": "Proprietary",
    "type": "project",
    "require": {
        "php": ">=7.1.3",
        "ext-bcmath": "*",
        "ext-gd": "*",
        "ext-pdo_mysql": "*",
        "barryvdh/laravel-debugbar": "^3.0.0",
        "barryvdh/laravel-dompdf": "^0.8.1",
        "bugsnag/bugsnag-laravel": "^2.0",
        "doctrine/inflector": "1.1.*",
        "doctrine/instantiator": "1.1.0",
        "fideloper/proxy": "~3.3",
        "hackzilla/password-generator": "^1.3",
        "hashids/hashids": "^2.0",
        "ignited/laravel-omnipay": "2.3.*",
        "laravel-notification-channels/telegram": "^0.0.5",
        "laravel/cashier": "~7.0",
        "laravel/framework": "5.5.*",
        "laravel/spark": "~3.0",
        "laravel/tinker": "~1.0",
        "omnipay/paypal": "^2.6",
        "omnipay/stripe": "^2.4",
        "phpdocumentor/reflection-docblock": "3.2.2",
        "predis/predis": "^1.1",
        "propaganistas/laravel-phone": "^2.8",
        "pusher/pusher-php-server": "~3.0",
        "shipping-docker/vessel": "^3.1",
        "simonhamp/ensemble-plugin": "dev-composer-dependency",
        "symfony/dom-crawler": "^4.1",
        "symfony/event-dispatcher": "^2.8",
        "symfony/yaml": "3.*"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.2",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/php-token-stream": "<2",
        "phpunit/phpunit": "~5",
        "laravel/browser-kit-testing": "^1.0",
        "filp/whoops": "~2.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Support/helpers.php"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php",
            "tests/ApiTestCase.php",
            "tests/BrowserKitTestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize",
            "php artisan telegram:setup"
        ],
        "docker-up": "./vessel start",
        "docker-down": "./vessel stop",
        "docker-destroy": "./vessel down --rmi all",
        "cs": "php-cs-fixer fix",
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://spark-satis.laravel.com"
        },
        {
            "type": "vcs",
            "url": "https://github.com/Jamesking56/ensemble-plugin.git"
        }
    ],
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    }
}

You can see database is listed in the classmap, meaning it needs to be there for composer to generate a new autoloader.

Jamesking56 commented 5 years ago

In fact, I just found an option: --no-autoloader - I'll try this now

Jamesking56 commented 5 years ago

Got it working :tada: I'll create a PR

renovate-bot commented 5 years ago

:tada: This issue has been resolved in version 13.99.14 :tada:

The release is available on:

Your semantic-release bot :package::rocket: