Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`git` command output not shown on clone error #8351

sapphirecat opened this issue Oct 1, 2019 · 3 comments


Copy link

commented Oct 1, 2019

I have a private repository I'm trying to clone into an AWS CodeBuild local test environment. The build was also failing in the real CodeBuild service.

The only info I can get out of composer -vvv is that the git clone commands fail. I need the error message to diagnose what the problem is. (I haven't figured out how to successfully get back into the exited container, either.)

Build portion of the container output:

agent_1  | [Container] 2019/10/01 20:51:18 Running command composer -vvv install --no-ansi --no-dev --optimize-autoloader
agent_1  | Reading ./composer.json
agent_1  | Loading config file ./composer.json
agent_1  | Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
agent_1  | Executing command (/codebuild/output/srcDownload/src): git branch --no-color --no-abbrev -v
agent_1  | Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json
agent_1  | To initialize a project, please create a composer.json file as described in the "Getting Started" section
agent_1  | Reading /codebuild/output/srcDownload/src/vendor/composer/installed.json
agent_1  | Running 1.9.0 (2019-08-02 20:55:32) with PHP on Linux / 4.15.0-64-generic
agent_1  | Reading ./composer.lock
agent_1  | Loading composer repositories with package information
agent_1  | Installing dependencies from lock file
agent_1  | Reading ./composer.lock
agent_1  | Resolving dependencies through SAT
agent_1  | Looking at all rules.
agent_1  |
agent_1  | Dependency resolution completed in 0.003 seconds
agent_1  | Analyzed 113 packages to resolve dependencies
agent_1  | Analyzed 264 rules to resolve dependencies
agent_1  | Package operations: 1 install, 0 updates, 0 removals
agent_1  | Installs: fidelis/awslib:v1.4.0
agent_1  |   - Installing fidelis/awslib (v1.4.0): Executing command (CWD): git --version
agent_1  |
agent_1  |     Cloning to cache at '/root/.composer/cache/vcs/'
agent_1  | Executing command (CWD): git clone --mirror '' '/root/.composer/cache/vcs/'
agent_1  | Executing command (CWD): git --version
agent_1  | Cloning adb9f145cb3731473e26f332565715728fd29b75
agent_1  | Executing command (CWD): git clone --no-checkout '' '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && cd '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && git remote add composer '' && git fetch composer
agent_1  | Executing command (CWD): rm -rf '/codebuild/output/srcDownload/src/vendor/fidelis/awslib'
agent_1  | Executing command (CWD): git --version
agent_1  | Failed: [RuntimeException] Failed to execute git clone --no-checkout '' '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && cd '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && git remote add composer '' && git fetch composer
agent_1  |
agent_1  |
agent_1  |
agent_1  |
agent_1  |   [RuntimeException]
agent_1  |   Failed to execute git clone --no-checkout '' '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && cd '/codebuild/output/srcDownload/src/vendor/fidelis/awslib' && git remote add composer '' && git fetch composer
agent_1  |
agent_1  |
agent_1  | Exception trace:
agent_1  |  () at phar:///usr/bin/composer/src/Composer/Util/Git.php:354
agent_1  |  Composer\Util\Git->throwException() at phar:///usr/bin/composer/src/Composer/Util/Git.php:221
agent_1  |  Composer\Util\Git->runCommand() at phar:///usr/bin/composer/src/Composer/Downloader/GitDownloader.php:84
agent_1  |  Composer\Downloader\GitDownloader->doDownload() at phar:///usr/bin/composer/src/Composer/Downloader/VcsDownloader.php:90
agent_1  |  Composer\Downloader\VcsDownloader->download() at phar:///usr/bin/composer/src/Composer/Downloader/DownloadManager.php:216
agent_1  |  Composer\Downloader\DownloadManager->download() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:197
agent_1  |  Composer\Installer\LibraryInstaller->installCode() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:101
agent_1  |  Composer\Installer\LibraryInstaller->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:173
agent_1  |  Composer\Installer\InstallationManager->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:160
agent_1  |  Composer\Installer\InstallationManager->execute() at phar:///usr/bin/composer/src/Composer/Installer.php:597
agent_1  |  Composer\Installer->doInstall() at phar:///usr/bin/composer/src/Composer/Installer.php:229
agent_1  |  Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/InstallCommand.php:122
agent_1  |  Composer\Command\InstallCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:245
agent_1  |  Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:835
agent_1  |  Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:185
agent_1  |  Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:267
agent_1  |  Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
agent_1  |  Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:106
agent_1  |  Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:61
agent_1  |  require() at /usr/bin/composer:24
agent_1  |
agent_1  | install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
agent_1  |
agent_1  |
agent_1  | [Container] 2019/10/01 20:51:19 Command did not exit successfully composer -vvv install --no-ansi --no-dev --optimize-autoloader exit status 1
agent_1  | [Container] 2019/10/01 20:51:19 Phase complete: BUILD State: FAILED

I can't use --prefer-dist because CodeCommit does not provide them.


This comment has been minimized.

Copy link

commented Oct 2, 2019

Also relevant: I was using composer 1.9.0.

I got a new idea and did git ls-remote $REPO in the pre-build script, which allowed me to debug the problem, so this ticket isn't urgent. It's just a feature request, to pass through git errors on failures. Thanks!


This comment has been minimized.

Copy link

commented Oct 6, 2019

The stderr output of the git process should already be included in the exception message:

            $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);

So I am not sure what else we can do..

@alcohol alcohol added the Support label Oct 7, 2019

This comment has been minimized.

Copy link

commented Oct 7, 2019

In that case, $this->process->getErrorOutput() must be failing?

I recreated a git problem (bad auth) and ran composer install -vvv 2>~/err.txt | tee ~/out.txt but I still don't see any git error output in the results. out.txt is a zero byte file and, in case I overlooked something, here's err.txt for the operation:

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/fidelis/awsbootstrap): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/fidelis/.composer/composer.json
To initialize a project, please create a composer.json file as described in the "Getting Started" section
Reading /var/fidelis/awsbootstrap/vendor/composer/installed.json
Running 1.9.0 (2019-08-02 20:55:32) with PHP on Linux / 4.15.0-65-generic
Reading ./composer.lock
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Reading ./composer.lock
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Analyzed 80 packages to resolve dependencies
Analyzed 121 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: fidelis/awslib:v1.4.0
  - Installing fidelis/awslib (v1.4.0): Executing command (CWD): git --version

    Cloning to cache at '/home/fidelis/.composer/cache/vcs/'
Executing command (CWD): git clone --mirror '' '/home/fidelis/.composer/cache/vcs/'
Executing command (CWD): git --version
Cloning adb9f145cb3731473e26f332565715728fd29b75
Executing command (CWD): git clone --no-checkout '' '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' && cd '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' && git remote add composer '' && git fetch composer
Executing command (CWD): rm -rf '/var/fidelis/awsbootstrap/vendor/fidelis/awslib'
Executing command (CWD): git --version
Failed: [RuntimeException] Failed to execute git clone --no-checkout '' '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' && cd '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' && git remote add composer '' && git fetch composer

  Failed to execute git clone --no-checkout ''   
  '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' && cd '/var/fidelis/awsbootstrap/vendor/fidelis/aw  
  slib' && git remote add composer '' && git fe  
  tch composer                                                                                          

Exception trace:
 () at phar:///usr/bin/composer/src/Composer/Util/Git.php:354
 Composer\Util\Git->throwException() at phar:///usr/bin/composer/src/Composer/Util/Git.php:221
 Composer\Util\Git->runCommand() at phar:///usr/bin/composer/src/Composer/Downloader/GitDownloader.php:84
 Composer\Downloader\GitDownloader->doDownload() at phar:///usr/bin/composer/src/Composer/Downloader/VcsDownloader.php:90
 Composer\Downloader\VcsDownloader->download() at phar:///usr/bin/composer/src/Composer/Downloader/DownloadManager.php:216
 Composer\Downloader\DownloadManager->download() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:197
 Composer\Installer\LibraryInstaller->installCode() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:101
 Composer\Installer\LibraryInstaller->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///usr/bin/composer/src/Composer/Installer.php:597
 Composer\Installer->doInstall() at phar:///usr/bin/composer/src/Composer/Installer.php:229
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/InstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:267
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:106
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:61
 require() at /usr/bin/composer:24

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

The git output does not seem to be included. If I run git clone --no-checkout '' '/var/fidelis/awsbootstrap/vendor/fidelis/awslib' 2>~/git-err.txt | tee ~/git-out.txt, output is empty again and the git stderr output is the following:

Cloning into '/var/fidelis/awsbootstrap/vendor/fidelis/awslib'... Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I really don't see this output from composer.

While I'm here, the composer version in full is:

Composer version 1.9.0 2019-08-02 20:55:32

This should be a release file directly from the getcomposer downloads page. File sha256 is c9dff69d092bdec14dee64df6677e7430163509798895fbd54891c166c5c0875.

Please let me know if I can do anything else to clarify. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.