I'm building an automated script that installs the latest version of Symfony 2.2, adds our company's CMS bundles to composer.json
, creates a couple of new bundles and so on.
The automation works otherwise fine, but occasionally some of the vendor downloads from GitHub fail randomly due to timeouts. When I run php composer.phar install
again, the download usually succeeds and the install process fails again a few dependencies later. After about 10 executions, everything is finally installed.
This causes big problems for the installer, as it currently quits and cleans up everything it installed in case the assertions fail. Is there a way I can either keep running the composer install command until I'm sure everything is installed, or ask composer to retry the downloads if they fail?
Composer now has a built in feature to retry downloads, see:
https://github.com/composer/composer/commit/5267bafa2cb28e564dbca8d1bfaa64de2a120827
You could also check the exit codes of composer and rerun it, if it fails.
I've gotten past this using a local repository for large packages (usually full of generated code and images). Just download the zip of Symfony and edit your composer.json to add a local repository point
"require": {
"symfony/symfony": "2.2.1"
},
"repositories": [
{
"type": "package",
"package": {
"name" : "symfony/symfony",
"version" : "2.2.1",
"dist": {
"url": "/Users/cassell/Symfony_Standard_Vendors_2.2.1.zip",
"type": "zip"
}
}
}
]