From 1736ea8ca213ddccf4f1b479efe7849b9064e7b7 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 3 May 2021 11:26:52 -0700 Subject: Retry yarn package installs We're seeing occasional npm install failures in jobs; retry the "yarn install" command if it fails. Also, pass the YARN_REGISTRY env var in the tox remote job. Change-Id: Ic80dccf0869ce805368f678eafcfdf48f8bf9bea --- tools/pip.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/pip.sh b/tools/pip.sh index 914c7ffe7..ddcc12d26 100755 --- a/tools/pip.sh +++ b/tools/pip.sh @@ -47,7 +47,18 @@ then echo "Using yarn registry: ${YARN_REGISTRY}" sed -i "s#https://registry.yarnpkg.com#${YARN_REGISTRY}#" yarn.lock fi - yarn install --verbose + + # Be forgiving of package retrieval errors + attempts=0 + until yarn install --verbose; do + ((attempts++)) + if [[ $attempts > 2 ]] + then + echo "Failed installing npm packages" + exit 1 + fi + done + yarn build if [[ -n "${YARN_REGISTRY}" ]] then -- cgit v1.2.1