From e8e38037c294dbfb1ac5ac77bbd1c0e38b334108 Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Mon, 3 Jun 2019 15:12:57 +0200 Subject: [PATCH] chore(build): Disable concurrency in pack.sh (#2723) There appear to be a file system race condition during dotnet project builds where parallel instances race for the same files, resulting in sporadic build failures due to not being able to access a file (that was cleaned up by another process already). Disabling parallelism seems to be the easiest way forward, and also the cheapest way to validate the root cause was correctly identified. The `buildspec.yml` will allow skipping pack.sh if the `SKIP_PACK` environment variable is set. --- buildspec.yaml | 2 +- pack.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildspec.yaml b/buildspec.yaml index b23384f617e95..ff7a48d9fd39e 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -12,7 +12,7 @@ phases: - /bin/bash ./build.sh post_build: commands: - - "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh" + - "[ -f .BUILD_COMPLETED ] && [ -z "${SKIP_PACK:-}" ] && /bin/bash ./pack.sh" artifacts: files: - "**/*" diff --git a/pack.sh b/pack.sh index 11736d22b46e9..bf3daa10097c4 100755 --- a/pack.sh +++ b/pack.sh @@ -16,7 +16,7 @@ scopes=$(lerna ls 2>/dev/null | grep -v "(private)" | cut -d" " -f1 | xargs -n1 # Run the "cdk-package" script in all modules. For jsii modules, this invokes jsii-pacmak which generates and builds multi-language # outputs. For non-jsii module, it will just run "npm pack" and place the output in dist/npm # (which is similar to how pacmak outputs it). -lerna run ${scopes} --sort --stream package +lerna run ${scopes} --sort --concurrency=1 --stream package # Collect dist/ from all modules into the root dist/ for dir in $(find packages -name dist | grep -v node_modules); do