From 8295e742c959a859a444b772b2323f6b8e7a7ede Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Thu, 13 Oct 2016 07:57:09 -0400 Subject: [PATCH 1/2] Fix for spurious 'cb() never called' errors. Some Jenkins builds are erroring when attempting to set up the npm environment with the error: `npm ERR! cb() never called!` Although it could point to a couple of different things, it is more classically a sign of a dirty npm environment cache. Cleaning the cache at the start of any given Jenkins job (which are sourced through this file) should alleviate the problem. --- scripts/jenkins-common.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/jenkins-common.sh b/scripts/jenkins-common.sh index 82cba87b00..3cfff5bebf 100644 --- a/scripts/jenkins-common.sh +++ b/scripts/jenkins-common.sh @@ -24,3 +24,7 @@ source $HOME/edx-venv/bin/activate # add the node_js packages dir to PATH PATH=$PATH:node_modules/.bin + +# Manage the npm cache on Jenkins. +# (In this case, remove it. That ensures from run-to-run, it is a clean npm environment) +npm cache clean From b2467147ae489bd549be7199eda81b831806c17d Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Thu, 13 Oct 2016 12:05:18 -0400 Subject: [PATCH 2/2] Script should exit non-zero if there is an error raised. Also, help with an echo. --- scripts/jenkins-common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/jenkins-common.sh b/scripts/jenkins-common.sh index 3cfff5bebf..375eba3a0a 100644 --- a/scripts/jenkins-common.sh +++ b/scripts/jenkins-common.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + source $HOME/jenkins_env # Clear the mongo database @@ -27,4 +29,5 @@ PATH=$PATH:node_modules/.bin # Manage the npm cache on Jenkins. # (In this case, remove it. That ensures from run-to-run, it is a clean npm environment) +echo "--> Cleaning npm cache" npm cache clean