Skip to content

Commit 7170f40

Browse files
committed
build: improve stability of windows jobs further
With the recent commit to rework the convert symlink script, we addressed the high flakiness of module resolution errors due to broken/missing symlinks. Though, this commit introduces a new source of flakiness that we tried to avoid in the past— running too many WSL exe's at the same time. We fix this by reducing the batch size and adding another retry for safety. In addition, the patch branch uses an older NodeJS version where `fs.cp` seems to have issues when the source files are readonly— so we fix that by just invoking the shell's `cp` command. That one works
1 parent f73e3a3 commit 7170f40

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/windows-testing/convert-symlinks.mjs

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ async function transformDir(p) {
7575
} else {
7676
dereferenceFns.push(async () => {
7777
await fs.unlink(subPath);
78-
await fs.cp(realTarget, subPath, { recursive: true });
78+
// Note: NodeJS `fs.cp` can have issues when sources are readonly.
79+
await exec(`cp -R ${realTarget} ${subPath}`);
7980
});
8081
}
8182
} else if (file.isDirectory()) {
@@ -86,7 +87,7 @@ async function transformDir(p) {
8687
await Promise.all(directoriesToVisit.map((d) => transformDir(d)));
8788
}
8889

89-
function exec(cmd, maxRetries = 2) {
90+
function exec(cmd, maxRetries = 3) {
9091
return new Promise((resolve, reject) => {
9192
childProcess.exec(cmd, { cwd: rootDir }, (error) => {
9293
if (error !== null) {
@@ -119,7 +120,7 @@ try {
119120
// Re-link symlinks to work inside Windows.
120121
// This is done in batches to avoid flakiness due to WSL
121122
// See: https://github.com/microsoft/WSL/issues/8677.
122-
const batchSize = 100;
123+
const batchSize = 75;
123124
for (let i = 0; i < relinkFns.length; i += batchSize) {
124125
await Promise.all(relinkFns.slice(i, i + batchSize).map((fn) => fn()));
125126
}

0 commit comments

Comments
 (0)