From 351eb5f599ec6856b32133337951dea030ad1126 Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Wed, 17 Jun 2020 11:51:45 -0700 Subject: [PATCH] ncu-ci: create INFRA_FAILURES category Some errors we see are caused by underlying infrastructure issues (most commonly filesystem corruption). Correctly classifying can help when collecting statistics, when pinging the build team, or even for automated notification (see https://github.com/nodejs/build/issues/2359). --- lib/ci/ci_failure_parser.js | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/ci/ci_failure_parser.js b/lib/ci/ci_failure_parser.js index 8a91d935..34108678 100644 --- a/lib/ci/ci_failure_parser.js +++ b/lib/ci/ci_failure_parser.js @@ -34,10 +34,12 @@ const JENKINS_FAILURE = 'JENKINS_FAILURE'; const GIT_FAILURE = 'GIT_FAILURE'; const NCU_FAILURE = 'NCU_FAILURE'; const RESUME_FAILURE = 'RESUME_FAILURE'; +const INFRA_FAILURE = 'INFRA_FAILURE'; const FAILURE_TYPES = { BUILD_FAILURE, JS_TEST_FAILURE, CC_TEST_FAILURE, - JENKINS_FAILURE, GIT_FAILURE, NCU_FAILURE, RESUME_FAILURE + JENKINS_FAILURE, GIT_FAILURE, NCU_FAILURE, RESUME_FAILURE, + INFRA_FAILURE }; class CIResult { @@ -60,6 +62,14 @@ class BuildFailure extends CIResult { } } +// Usually needs to fix something in the Jenkins agent (or just restart it) +class InfraFailure extends CIResult { + constructor(ctx, reason) { + super(ctx, reason); + this.type = INFRA_FAILURE; + } +} + // Usually needs a fix in the test or the core class JSTestFailure extends CIResult { constructor(ctx, reason) { @@ -126,6 +136,25 @@ function failureMatcher(Failure, patterns, ctx, text) { // The elements are ranked by priority const FAILURE_FILTERS = [{ + // NOTE(mmarchini): infra-related issues should have the highest priority, as + // they can cause other issues to happen. + filter(ctx, text) { + const patterns = [{ + pattern: /Read-only file system/g, + context: { index: 0, contextBefore: 1, contextAfter: 0 } + }, + { + pattern: /Device or resource busy/g, + context: { index: 0, contextBefore: 1, contextAfter: 0 } + }, + { + pattern: /There is not enough space in the file system./g, + context: { index: 0, contextBefore: 1, contextAfter: 0 } + } + ]; + return failureMatcher(InfraFailure, patterns, ctx, text); + } +}, { // TODO: match indentation to avoid skipping context with '...' filter(ctx, text) { const pattern = /not ok \d+[\s\S]+? {2}\.\.\.\r?\n/mg; @@ -203,9 +232,6 @@ const FAILURE_FILTERS = [{ }, { filter(ctx, text) { const patterns = [{ - pattern: /There is not enough space in the file system./g, - context: { index: 0, contextBefore: 0, contextAfter: 5 } - }, { pattern: /sh: line /g, context: { index: 0, contextBefore: 0, contextAfter: 1 } }, {