Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .evergreen/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ functions:

# Make all the dirs
mkdir -p $ARTIFACTS_PATH
mkdir -p $NPM_CACHE_DIR
mkdir -p $NPM_TMP_DIR

- command: shell.exec
type: setup
Expand Down Expand Up @@ -195,18 +193,9 @@ functions:
npm config ls -l
echo "(if npm fails, debug.log will be uploaded to S3)"

# Install dependencies
# Install and check dependencies
bash ".evergreen/retry-with-backoff.sh" .evergreen/npm_ci.sh

# Will fail if versions of direct dependencies listed in package-lock
# are not matching versions defined in package.json file of any of the
# workspace packages
# This command is very noisy when running from root with --all, store
# the output in a file that will be uploaded with rest of the logs
LS_ALL_STDOUT_FILE="$(npm config get cache)/_logs/$(date -u +"%Y-%m-%dT%H_%M_%SZ")-npm-ls-all.log"
echo "Validating dependencies with \`npm ls --all\`..."
(npm ls --all > $LS_ALL_STDOUT_FILE && echo "No mismatched dependency versions") || (echo "\nThe \`npm ls\` command failed with mismatched dependencies error. This usually means that the dependency versions listed in package.json are not matching dependencies resolved and recorded in package-lock.json. If you updated package.json files in your PR, inspect the error output and try to re-install offending dependncies to fix the package-lock file." && exit 1)

bootstrap:
- command: shell.exec
type: setup
Expand Down
15 changes: 13 additions & 2 deletions .evergreen/npm_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@

set -e

npm cache clean -f
# Remove the cache and any potential install leftovers before installing again.
# We are running this script with a retry to deal with network issues, in some
# rare cases npm leaves stuff behind messing up a new attempt
rm -rf "$NPM_CACHE_DIR"
rm -rf node_modules
find configs -name 'node_modules' -type d -prune -exec rm -rf '{}' +
find packages -name 'node_modules' -type d -prune -exec rm -rf '{}' +
find scripts -name 'node_modules' -type d -prune -exec rm -rf '{}' +
npm ci --unsafe-perm
npm ci --unsafe-perm

# Will fail if versions of direct dependencies listed in package-lock are not
# matching versions defined in package.json file of any of the workspace
# packages. This command is very noisy when running from root with --all, store
# the output in a file that will be uploaded with rest of the logs
LS_ALL_STDOUT_FILE="$(npm config get cache)/_logs/$(date -u +"%Y-%m-%dT%H_%M_%SZ")-npm-ls-all.log"
echo "Validating dependencies with \`npm ls --all\`..."
(npm ls --all >$LS_ALL_STDOUT_FILE && echo "No mismatched dependency versions") || (echo ""; echo "The \`npm ls\` command failed with mismatched dependencies error. This usually means that the dependency versions listed in package.json are not matching dependencies resolved and recorded in package-lock.json. If you updated package.json files in your PR, inspect the error output and try to re-install offending dependncies to fix the package-lock file." && exit 1)
9 changes: 4 additions & 5 deletions .evergreen/print-compass-env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /usr/bin/env node
'use strict';
const path = require('path');

/*
This script writes a bash script that can be eval()'d in evergreen to modify the
Expand Down Expand Up @@ -79,18 +80,16 @@ function printCompassEnv() {
PATH = maybePrependPaths(PATH, pathsToPrepend);
printVar('PATH', PATH);

const npmCacheDir = `${newPWD}/.deps/.npm`;
const npmTmpDir = `${newPWD}/.deps/tmp`;
// not using `newPWD` here to avoid issues on windows where the value supposed
// to be a non-cygwin path
const npmCacheDir = path.resolve(__dirname, '..', '.deps', '.npm-cache');

printVar('ARTIFACTS_PATH', `${newPWD}/.deps`);
printVar('NPM_CACHE_DIR', npmCacheDir);
printVar('NPM_TMP_DIR', npmTmpDir);

// all npm var names need to be lowercase
// see: https://docs.npmjs.com/cli/v7/using-npm/config#environment-variables
printVar('npm_config_cache', npmCacheDir);
// npm tmp is deprecated, but let's keep it around just in case
printVar('npm_config_tmp', npmTmpDir);
// Also set in our .npmrc but that does not get picked up in the preinstall script.
printVar('npm_config_registry', 'https://registry.npmjs.org/');

Expand Down
Loading