From 487033a19b328b78648a970b775947288a04feb7 Mon Sep 17 00:00:00 2001 From: Sven Efftinge Date: Mon, 29 Jun 2020 17:29:43 +0200 Subject: [PATCH 1/2] chore(build): Increase yarn install network-timeout (#8751) This change increases the timeout to `yarn install` to stabilize the Gitpod prebuilds. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b58fa80e1c563..6a90f93fbbcbe 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" echo "=============================================================================================" echo "installing..." -yarn install --frozen-lockfile +yarn install --frozen-lockfile --network-timeout 1000000 fail() { echo "❌ Last command failed. Scroll up to see errors in log (search for '!!!!!!!!')." From a216739ea058cc77e75246b06e9888310fb9e0d2 Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Mon, 29 Jun 2020 16:54:42 +0100 Subject: [PATCH 2/2] chore(scripts): builddown should use foreach to support resuming builds (#8784) buildup and builddown currently use two entirely different approaches. This fix makes the builddown mirror the current buildup script, and alters foreach to support a --down flag in addition to --up. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- scripts/builddown | 29 +++++++++++++++++++++-------- scripts/foreach.sh | 26 ++++++++++++++++++-------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/scripts/builddown b/scripts/builddown index 6d75589573fff..181f08dbca389 100755 --- a/scripts/builddown +++ b/scripts/builddown @@ -1,14 +1,27 @@ #!/bin/bash set -euo pipefail +scriptdir=$(cd $(dirname $0) && pwd) + +echo "************************************************************" +echo " builddown usage:" +echo " - execute 'builddown --resume' to resume after failure" +echo " - execute 'builddown' to restart the build from the start" +echo "" +echo " for advanced usage, see ${scriptdir}/foreach.sh" +echo "************************************************************" -if ! [ -x "$(command -v yarn)" ]; then - echo "yarn is not installed. Follow the guide to install yarn - https://yarnpkg.com/en/docs/install." - exit 1 +if [ "$#" -eq 0 ]; then + ${scriptdir}/foreach.sh --reset +else + if [ "$1" != "--resume" ]; then + echo "Unknown option: $1" + exit 1 + fi fi -export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" +${scriptdir}/foreach.sh --down yarn build +${scriptdir}/foreach.sh --reset -scriptdir=$(cd $(dirname $0) && pwd) -export PATH=$(cd $scriptdir && npm bin):$PATH -scope=$(${scriptdir}/current-scope) -exec lerna run ${1:-build} --scope ${scope} --include-dependents +echo "************************************************************" +echo "builddown done" +echo "************************************************************" diff --git a/scripts/foreach.sh b/scripts/foreach.sh index 39fcb574be7e8..1a389a5d60a3a 100755 --- a/scripts/foreach.sh +++ b/scripts/foreach.sh @@ -18,6 +18,9 @@ # to run the command only against the current module and its dependencies: # foreach.sh --up COMMAND # +# to run the command only against the current module and its consumers: +# foreach.sh --down COMMAND +# # -------------------------------------------------------------------------------------------------- set -euo pipefail scriptdir=$(cd $(dirname $0) && pwd) @@ -61,17 +64,24 @@ if [[ "${1:-}" == "--skip" ]]; then exit 0 fi -up="" -up_desc="" -if [[ "${1:-}" == "--up" ]]; then +direction="" +direction_desc="" +if [[ "${1:-}" == "--up" || "${1:-}" == "--down" ]]; then if [ ! -f package.json ]; then - echo "--up can only be executed from within a module directory (looking for package.json)" + echo "--up or --down can only be executed from within a module directory (looking for package.json)" exit 1 fi scope=$(node -p "require('./package.json').name") - up=" --scope ${scope} --include-dependencies" - up_desc="('${scope}' and its dependencies)" + + if [[ "${1:-}" == "--up" ]]; then + direction=" --scope ${scope} --include-dependencies" + direction_desc="('${scope}' and its dependencies)" + else # --down + direction=" --scope ${scope} --include-dependents" + direction_desc="('${scope}' and its consumers)" + fi + shift fi @@ -89,8 +99,8 @@ fi if [ ! -f "${statefile}" ] && [ ! -f "${commandfile}" ]; then if [ ! -z "${command_arg}" ]; then command="${command_arg}" - success "starting new session ${up_desc}" - ${scriptdir}/../node_modules/.bin/lerna ls --all ${up} --toposort -p > ${statefile} + success "starting new session ${direction_desc}" + ${scriptdir}/../node_modules/.bin/lerna ls --all ${direction} --toposort -p > ${statefile} echo "${command}" > ${commandfile} else error "no active session, use \"$(basename $0) COMMAND\" to start a new session"