Skip to content

Commit a77848e

Browse files
authored
ncu-ci: create INFRA_FAILURES category (#441)
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 nodejs/build#2359).
1 parent 2858ab5 commit a77848e

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

lib/ci/ci_failure_parser.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ const JENKINS_FAILURE = 'JENKINS_FAILURE';
3434
const GIT_FAILURE = 'GIT_FAILURE';
3535
const NCU_FAILURE = 'NCU_FAILURE';
3636
const RESUME_FAILURE = 'RESUME_FAILURE';
37+
const INFRA_FAILURE = 'INFRA_FAILURE';
3738

3839
const FAILURE_TYPES = {
3940
BUILD_FAILURE, JS_TEST_FAILURE, CC_TEST_FAILURE,
40-
JENKINS_FAILURE, GIT_FAILURE, NCU_FAILURE, RESUME_FAILURE
41+
JENKINS_FAILURE, GIT_FAILURE, NCU_FAILURE, RESUME_FAILURE,
42+
INFRA_FAILURE
4143
};
4244

4345
class CIResult {
@@ -60,6 +62,14 @@ class BuildFailure extends CIResult {
6062
}
6163
}
6264

65+
// Usually needs to fix something in the Jenkins agent (or just restart it)
66+
class InfraFailure extends CIResult {
67+
constructor(ctx, reason) {
68+
super(ctx, reason);
69+
this.type = INFRA_FAILURE;
70+
}
71+
}
72+
6373
// Usually needs a fix in the test or the core
6474
class JSTestFailure extends CIResult {
6575
constructor(ctx, reason) {
@@ -126,6 +136,25 @@ function failureMatcher(Failure, patterns, ctx, text) {
126136

127137
// The elements are ranked by priority
128138
const FAILURE_FILTERS = [{
139+
// NOTE(mmarchini): infra-related issues should have the highest priority, as
140+
// they can cause other issues to happen.
141+
filter(ctx, text) {
142+
const patterns = [{
143+
pattern: /Read-only file system/g,
144+
context: { index: 0, contextBefore: 1, contextAfter: 0 }
145+
},
146+
{
147+
pattern: /Device or resource busy/g,
148+
context: { index: 0, contextBefore: 1, contextAfter: 0 }
149+
},
150+
{
151+
pattern: /There is not enough space in the file system./g,
152+
context: { index: 0, contextBefore: 1, contextAfter: 0 }
153+
}
154+
];
155+
return failureMatcher(InfraFailure, patterns, ctx, text);
156+
}
157+
}, {
129158
// TODO: match indentation to avoid skipping context with '...'
130159
filter(ctx, text) {
131160
const pattern = /not ok \d+[\s\S]+? {2}\.\.\.\r?\n/mg;
@@ -203,9 +232,6 @@ const FAILURE_FILTERS = [{
203232
}, {
204233
filter(ctx, text) {
205234
const patterns = [{
206-
pattern: /There is not enough space in the file system./g,
207-
context: { index: 0, contextBefore: 0, contextAfter: 5 }
208-
}, {
209235
pattern: /sh: line /g,
210236
context: { index: 0, contextBefore: 0, contextAfter: 1 }
211237
}, {

0 commit comments

Comments
 (0)