This is an automated email from the ASF dual-hosted git repository.
tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 0025c0a70ee NO-ISSUE: Fix `turbo ls` command with too many filters on
the Windows runner in GitHub Actions (#2636)
0025c0a70ee is described below
commit 0025c0a70ee61bcc2b38ca5eaf816664720484b8
Author: Thiago Lugli <[email protected]>
AuthorDate: Thu Oct 3 07:00:32 2024 -0300
NO-ISSUE: Fix `turbo ls` command with too many filters on the Windows
runner in GitHub Actions (#2636)
---
.../ci/build-partitioning/build_partitioning.ts | 32 +++++++++++++++++-----
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git
a/.github/supporting-files/ci/build-partitioning/build_partitioning.ts
b/.github/supporting-files/ci/build-partitioning/build_partitioning.ts
index b8f4893dd53..a9dcd6f77a5 100644
--- a/.github/supporting-files/ci/build-partitioning/build_partitioning.ts
+++ b/.github/supporting-files/ci/build-partitioning/build_partitioning.ts
@@ -173,13 +173,31 @@ async function getPartitions(): Promise<Array<None | Full
| Partial>> {
__PACKAGES_ROOT_PATHS.every((rootPath) => !path.startsWith(rootPath))
);
- const affectedPackageDirsInAllPartitions: Array<string> = await JSON.parse(
- execSync(
- `bash -c "turbo ls ${changedPackagesNames.map((packageName) =>
`--filter='...${packageName}'`).join(" ")} --output json"`
- ).toString()
- )
- .packages.items.map((item: { path: string }) => item.path)
- .map((pkgDir) => convertToPosixPathRelativeToRepoRoot(pkgDir));
+ // On Windows there's a 8191 character limit for commands in PowerShell.
+ // See
https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation
+ // To circunvent this, we break the package list in chunks, run turbo ls,
and then merge them all to a final list.
+ // Chunk size is defined as 50. This is an arbitrary value.
+ // If each package name has 100 characters, 50 of them is 5000 characters,
making the final command less than 8191.
+ const changedPackagesNamesChunks: string[][] = [];
+ const chunkSize = 50;
+ for (let i = 0; i < changedPackagesNames.length; i += chunkSize) {
+ changedPackagesNamesChunks.push(
+ changedPackagesNames.slice(i, Math.min(i + chunkSize,
changedPackagesNames.length - 1))
+ );
+ }
+
+ // Using a Set because it forces unique values, so no need to deduplicate.
+ const affectedPackageDirsInAllPartitionsSet = new Set<string>();
+ for (let packagesNamesChunk of changedPackagesNamesChunks) {
+ await JSON.parse(
+ execSync(
+ `bash -c "turbo ls ${packagesNamesChunk.map((packageName) => `-F
'...${packageName}'`).join(" ")} --output json"`
+ ).toString()
+ ).packages.items.forEach((item: { path: string }) => {
+
affectedPackageDirsInAllPartitionsSet.add(convertToPosixPathRelativeToRepoRoot(item.path));
+ });
+ }
+ const affectedPackageDirsInAllPartitions =
Array.from(affectedPackageDirsInAllPartitionsSet);
return await Promise.all(
partitionDefinitions.map(async (partition) => {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]