Unverified Commit 56c249bf authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Add metrics for more types of failures (#509)

Add metrics for more types of failures
parent 6c52af1e
...@@ -49,6 +49,7 @@ handle_failure() { ...@@ -49,6 +49,7 @@ handle_failure() {
fail_node_install "$LOG_FILE" fail_node_install "$LOG_FILE"
fail_yarn_install "$LOG_FILE" fail_yarn_install "$LOG_FILE"
fail_invalid_semver "$LOG_FILE" fail_invalid_semver "$LOG_FILE"
log_other_failures "$LOG_FILE"
warn_untracked_dependencies "$LOG_FILE" warn_untracked_dependencies "$LOG_FILE"
warn_angular_resolution "$LOG_FILE" warn_angular_resolution "$LOG_FILE"
warn_missing_devdeps "$LOG_FILE" warn_missing_devdeps "$LOG_FILE"
......
...@@ -37,6 +37,7 @@ fail_invalid_package_json() { ...@@ -37,6 +37,7 @@ fail_invalid_package_json() {
fail_dot_heroku() { fail_dot_heroku() {
if [ -f "${1:-}/.heroku" ]; then if [ -f "${1:-}/.heroku" ]; then
mcount "failures.dot-heroku"
header "Build failed" header "Build failed"
warn "The directory .heroku could not be created warn "The directory .heroku could not be created
...@@ -51,6 +52,7 @@ fail_dot_heroku() { ...@@ -51,6 +52,7 @@ fail_dot_heroku() {
fail_dot_heroku_node() { fail_dot_heroku_node() {
if [ -f "${1:-}/.heroku/node" ]; then if [ -f "${1:-}/.heroku/node" ]; then
mcount "failures.dot-heroku-node"
header "Build failed" header "Build failed"
warn "The directory .heroku/node could not be created warn "The directory .heroku/node could not be created
...@@ -118,7 +120,7 @@ fail_multiple_lockfiles() { ...@@ -118,7 +120,7 @@ fail_multiple_lockfiles() {
fail_yarn_lockfile_outdated() { fail_yarn_lockfile_outdated() {
local log_file="$1" local log_file="$1"
if grep -qi 'error Your lockfile needs to be updated' "$log_file"; then if grep -qi 'Your lockfile needs to be updated' "$log_file"; then
mcount "failures.outdated-yarn-lockfile" mcount "failures.outdated-yarn-lockfile"
echo "" echo ""
warn "Outdated Yarn lockfile warn "Outdated Yarn lockfile
...@@ -245,6 +247,51 @@ fail_invalid_semver() { ...@@ -245,6 +247,51 @@ fail_invalid_semver() {
fi fi
} }
log_other_failures() {
local log_file="$1"
if grep -qi "sh: 1: .*: not found" "$log_file"; then
mcount "failures.dev-dependency-tool-not-installed"
fi
if grep -qi "Failed at the bcrypt@\d.\d.\d install script" "$log_file"; then
mcount "failures.bcrypt-permissions-issue"
fi
if grep -qi "Versions of @angular/compiler-cli and typescript could not be determined" "$log_file"; then
mcount "failures.ng-cli-version-issue"
fi
if grep -qi "Cannot read property '0' of undefined" "$log_file"; then
mcount "failures.npm-property-zero-issue"
fi
if grep -qi "npm is known not to run on Node.js v\d.\d.\d" "$log_file"; then
mcount "failures.npm-known-bad-version"
fi
# "notarget No matching version found for" = npm
# "error Couldn't find any versions for" = yarn
if grep -q -e "notarget No matching version found for" -e "error Couldn't find any versions for" "$log_file"; then
mcount "failures.bad-version-for-dependency"
fi
if grep -qi "Module not found: Error: Can't resolve" "$log_file"; then
mcount "failures.webpack-module-not-found"
fi
if greq -qi "You are likely using a version of node-tar or npm that is incompatible with this version of Node.js" "$log_file"; then
mcount "failures.node-9-npm-issue"
fi
if grep -qi "console.error(\`a bug known to break npm" "$log_file"; then
mcount "failures.old-node-new-npm"
fi
if grep -qi "sass-loader/lib/loader.js:3:14" "$log_file"; then
mcount "failures.webpack-sass-loader-error"
fi
}
warning() { warning() {
local tip=${1:-} local tip=${1:-}
local url=${2:-https://devcenter.heroku.com/articles/nodejs-support} local url=${2:-https://devcenter.heroku.com/articles/nodejs-support}
......
...@@ -181,7 +181,7 @@ testErrorYarnAndNpmShrinkwrap() { ...@@ -181,7 +181,7 @@ testErrorYarnAndNpmShrinkwrap() {
testYarnLockfileOutOfDate() { testYarnLockfileOutOfDate() {
compile "yarn-lockfile-out-of-date" compile "yarn-lockfile-out-of-date"
assertCaptured "error Your lockfile needs to be updated" assertCaptured "Your lockfile needs to be updated"
assertCaptured "Outdated Yarn lockfile" assertCaptured "Outdated Yarn lockfile"
assertCaptured "https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-outdated-yarn-lockfile" assertCaptured "https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-outdated-yarn-lockfile"
assertCapturedError assertCapturedError
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment