Ignore errors during stackviz build

This removes the 'set -e' bash option to make sure 89-prepare-stackviz
doesn't cause DIB builds to fail if npm encounters an error. Instead,
errors are caught and either logged or ignored outright and the script
always returns successfully.

Additionally, this adds a 15 minute timeout for the npm install to
prevent any image build failures that would take excessively long.

Change-Id: I5272eac323069a8df8ab64e1cc5d7c0bad9bd879
This commit is contained in:
Tim Buckley 2016-07-06 08:23:07 -06:00
parent 5d8bb88057
commit 16595936ee

View File

@ -15,18 +15,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# dib-lint: disable=setu setpipefail
# dib-lint: disable=setu setpipefail sete
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -e
STACKVIZ_NPM_TIMEOUT="15m"
STACKVIZ_DIR=/opt/stackviz
cp -r /opt/git/openstack/stackviz $STACKVIZ_DIR
cd $STACKVIZ_DIR
npm install
npm run prod
timeout $STACKVIZ_NPM_TIMEOUT npm install
ret=$?
rm -rf node_modules/
if [[ $ret -eq 0 ]]; then
npm run prod && rm -rf node_modules/
else
echo "stackviz build aborted due to npm error"
rm -rf $STACKVIZ_DIR
fi
exit 0