简体   繁体   中英

Composer install fail on TFS Server

We are running a Team Foundation Server (on premises) and as part of a build process it runs composer to install dependancies. Sometime in the last week this process has started failing and I cannot figure out why.

Here is the console output from a failed run:

- Installing symfony/polyfill-ctype (v1.11.0): Downloading (connecting...)Downloading (failed) 
Downloading (connecting...)Downloading (failed) 
Downloading (connecting...)Downloading (failed)  Failed to download symfony/polyfill-ctype from dist: The "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Now trying to download from source
- Installing symfony/polyfill-ctype (v1.11.0): Cloning 82ebae0220


[RuntimeException]
Failed to clone https://github.com/symfony/polyfill-ctype.git via https, ss
h protocols, aborting.

- https://github.com/symfony/polyfill-ctype.git
Cloning into 'D:\agent\_work\3\s\vendor\symfony\polyfill-ctype'...
fatal: unable to access 'https://github.com/symfony/polyfill-ctype.git/':
Failed to connect to github.com port 443: Timed out

- git@github.com:symfony/polyfill-ctype.git
Cloning into 'D:\agent\_work\3\s\vendor\symfony\polyfill-ctype'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

Here is part of the output from a successful run about a month ago:

2021-03-25T09:46:09.0972736Z Package operations: 28 installs, 0 updates, 0 removals
2021-03-25T09:46:09.0972880Z - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
2021-03-25T09:46:09.2716787Z - Installing webmozart/assert (1.4.0): Loading from cache
2021-03-25T09:46:09.5064411Z - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
2021-03-25T09:46:09.7547542Z - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
2021-03-25T09:46:10.0682007Z - Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
2021-03-25T09:46:10.4608228Z - Installing phpunit/php-token-stream (3.0.1): Loading from cache

The successful run shows it is "loading from cache" rather than going to github. I'm not that experienced with composer so I'm not sure what has gone wrong. No settings on our TFS system have changed to my knowledge.

The server that this runs cannot access github as it is behind a firewall & proxy that block it. But that has always been the case.

Does anyone know why composer would previously have been using a cache and is now trying to access github?

I have been searching the internet for hours for how the composer cache works but haven't been able to find anything that helps.

Many thanks for any help.

  1. Set variable system.debug to true to check the log to see whether you can get more information.

  2. It seems the composer cache is removed on your agent machine recently. You would either make your agent machine access the internet, or install the package manually on the agent machine.

I finally got this issue fixed by getting our corporate proxy updated to allow our build server to access github.

I still do not know how builds were working for so long without issue because to my best knowledge the build server would not have been allowed to access github for at least the last year. I can only assume that either somebody manually setup the Composer cache or the server could, at some time, access github and then the cache just lasted for a very long time.

This was one of those confusing problems where nothing seems to have changed to explain it. However I think something must have changed just a long time ago and the cache was masking it.

Thanks to everyone who helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM