Skip to content

Commit 2695371

Browse files
committed
Build/Test Tools: Explain Composer failures during environment startup.
Run `composer update -W` through the shared Compose retry helper in `start.js`. Report a focused Composer error after exhausted retries, preserving startup ordering and the failing exit status. Developed in: #9360 Props iamadisingh, azaozz, r1k0. Fixes #62807. git-svn-id: https://develop.svn.wordpress.org/trunk@65150 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 094ed92 commit 2695371

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"lint:jsdoc": "wp-scripts lint-js",
141141
"lint:jsdoc:fix": "wp-scripts lint-js --fix",
142142
"typecheck:js": "tsc --build",
143-
"env:start": "node ./tools/local-env/scripts/start.js && node ./tools/local-env/scripts/docker.js run -T --rm php composer update -W",
143+
"env:start": "node ./tools/local-env/scripts/start.js",
144144
"env:stop": "node ./tools/local-env/scripts/docker.js down",
145145
"env:restart": "npm run env:stop && npm run env:start",
146146
"env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",

‎tools/local-env/scripts/start.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,14 @@ if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
9393
{ stdio: 'inherit' }
9494
);
9595
}
96+
97+
// `composer update` reaches repo.packagist.org, so it is re-attempted for the same reasons as `up`.
98+
const composer = local_env_utils.compose_with_retry( [ 'run', '-T', '--rm', 'php', 'composer', 'update', '-W' ], 3 );
99+
100+
if ( composer.status !== 0 ) {
101+
console.error( '\nThere was an error while running PHP Composer update.' );
102+
console.error( 'This is often caused by network issues or Packagist.org downtime.' );
103+
console.error( 'Please check your internet connection and try again.' );
104+
105+
process.exit( composer.status ?? 1 );
106+
}

0 commit comments

Comments
 (0)