Skip to content

Commit c7967b1

Browse files
authored
Distribute bundles more evenly into CI shards (#26208)
## Summary Previously, we distributed bundles into shards and then checked if we need to actually build that bundle. This can under-utilize shards heavily (e.g. https://app.circleci.com/pipelines/github/facebook/react/38611/workflows/df9e56e7-d476-49ee-9392-d8b37c81aa66/jobs/630545/parallel-runs/28?filterBy=ALL only building a single bundle). This won't result in an optimal distribution but, if we're lucky, we might end up with shard #26 not taking 7mins anymore. The slowest shard ultimately decicdes when we can start with testing builds. ## How did you test this change? - [x] `CIRCLE_NODE_INDEX=28 CIRCLE_NODE_TOTAL=40 yarn build` building more than 1 bundle - [x] Check timings of `yarn_build` so that we don't up with an over-stuffed shard (e.g. a shard having to build all the expensive bundles). Casually dropping 60min idle time 🎉: - Before: https://app.circleci.com/pipelines/github/facebook/react/38683/workflows/a41533d7-811c-439d-9751-214ba06035c5/jobs/632230/timing - After: https://app.circleci.com/pipelines/github/facebook/react/38686/workflows/8a770df6-5b3e-41ea-b3b5-10abeae703e7/jobs/632247/timing
1 parent bb1e3d0 commit c7967b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/rollup/build.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,6 @@ function resolveEntryFork(resolvedEntry, isFBBundle) {
527527
}
528528

529529
async function createBundle(bundle, bundleType) {
530-
if (shouldSkipBundle(bundle, bundleType)) {
531-
return;
532-
}
533-
534530
const filename = getFilename(bundle, bundleType);
535531
const logKey =
536532
chalk.white.bold(filename) + chalk.dim(` (${bundleType.toLowerCase()})`);
@@ -766,6 +762,10 @@ async function buildEverything() {
766762
);
767763
}
768764

765+
bundles = bundles.filter(([bundle, bundleType]) => {
766+
return !shouldSkipBundle(bundle, bundleType);
767+
});
768+
769769
if (process.env.CIRCLE_NODE_TOTAL) {
770770
// In CI, parallelize bundles across multiple tasks.
771771
const nodeTotal = parseInt(process.env.CIRCLE_NODE_TOTAL, 10);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy