Skip to content

ncu-ci: add commit-v8 #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
21 changes: 19 additions & 2 deletions bin/ncu-ci
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const {
JobParser,
parseJobFromURL,
CI_TYPES_KEYS: {
PR, COMMIT, BENCHMARK
PR, COMMIT, COMMIT_V8, BENCHMARK
}
} = require('../lib/ci/ci_type_parser');

const {
PRBuild, BenchmarkRun, CommitBuild, HealthBuild,
PRBuild, BenchmarkRun, CommitBuild, CommitV8Build, HealthBuild,
listBuilds, FailureAggregator, jobCache
} = require('../lib/ci/ci_result_parser');
const clipboardy = require('clipboardy');
Expand Down Expand Up @@ -98,6 +98,18 @@ const argv = yargs
},
handler
})
.command({
command: 'commit-v8 <jobid>',
desc: 'Show results of a node-test-commit-v8-linux CI job',
builder: (yargs) => {
yargs
.positional('jobid', {
describe: 'id of the job',
type: 'number'
});
},
handler
})
.command({
command: 'benchmark <jobid>',
desc: 'Show results of a benchmark-node-micro-benchmarks CI job',
Expand Down Expand Up @@ -128,6 +140,7 @@ const argv = yargs

const commandToType = {
commit: COMMIT,
'commit-v8': COMMIT_V8,
pr: PR,
benchmark: BENCHMARK
};
Expand Down Expand Up @@ -173,6 +186,9 @@ class CICommand {
case COMMIT:
build = new CommitBuild(cli, request, job.jobid);
break;
case COMMIT_V8:
build = new CommitV8Build(cli, request, job.jobid);
break;
case BENCHMARK:
build = new BenchmarkRun(cli, request, job.jobid);
break;
Expand Down Expand Up @@ -342,6 +358,7 @@ async function main(command, argv) {
}
case 'pr':
case 'commit':
case 'commit-v8':
case 'benchmark': {
commandHandler = new JobCommand(cli, request, argv, command);
break;
Expand Down
26 changes: 26 additions & 0 deletions lib/ci/ci_failure_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
}

const BUILD_FAILURE = 'BUILD_FAILURE';
const SETUP_FAILURE = 'SETUP_FAILURE';
const JS_TEST_FAILURE = 'JS_TEST_FAILURE';
const CC_TEST_FAILURE = 'CC_TEST_FAILURE';
const JENKINS_FAILURE = 'JENKINS_FAILURE';
Expand Down Expand Up @@ -60,6 +61,13 @@
}
}

class SetupFailure extends CIResult {
constructor(ctx, reason) {
super(ctx, reason);
this.type = SETUP_FAILURE;

Check warning on line 67 in lib/ci/ci_failure_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_failure_parser.js#L66-L67

Added lines #L66 - L67 were not covered by tests
}
}

// Usually needs a fix in the test or the core
class JSTestFailure extends CIResult {
constructor(ctx, reason) {
Expand Down Expand Up @@ -141,6 +149,24 @@
match => new JSTestFailure(ctx, match)
);
}
}, {
// gclient sync failed to fetch something from upstream
filter(ctx, text) {
const patterns = [{
pattern: /Failed to fetch file.+/g,
context: { index: 0, contextBefore: 0, contextAfter: 0 }
}];
return failureMatcher(SetupFailure, patterns, ctx, text);
}
}, {
// V8 cctests
filter(ctx, text) {
const patterns = [{
pattern: /=== cctest\/[\S]+ ===[\s\S]+?Command: .*\r?\n/g,
context: { index: 0, contextBefore: 0, contextAfter: 0 }
}];
return failureMatcher(CCTestFailure, patterns, ctx, text);
}
}, {
filter(ctx, text) {
const patterns = [{
Expand Down
55 changes: 36 additions & 19 deletions lib/ci/ci_result_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@
return url.replace(`https://${CI_DOMAIN}/`, '').replace('api/json', '');
}

function displayFailure(cli, failure) {
const { url, reason } = failure;
cli.separator(getNodeName(url));
cli.table('URL', url);
if (failure.type) {
cli.table('Type', failure.type);

Check warning on line 71 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L67-L71

Added lines #L67 - L71 were not covered by tests
}
if (failure.builtOn) {
cli.table('Built On', failure.builtOn);

Check warning on line 74 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L73-L74

Added lines #L73 - L74 were not covered by tests
}
if (!reason.includes('\n') && reason.length < 40) {
cli.table('Reason', chalk.red(reason));

Check warning on line 77 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L76-L77

Added lines #L76 - L77 were not covered by tests
} else {
cli.table('Reason', '');
const lines = reason.split('\n');
cli.log(` ${chalk.red(lines[0])}`);
for (let i = 1; i < lines.length; ++i) {
cli.log(` ${lines[i]}`);

Check warning on line 83 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L79-L83

Added lines #L79 - L83 were not covered by tests
}
}
}

function getUrl(path) {
return `https://${CI_DOMAIN}/${getPath(path)}`;
}
Expand Down Expand Up @@ -270,25 +292,7 @@

displayFailure(failure) {
const { cli } = this;
const { url, reason } = failure;
cli.separator(getNodeName(url));
cli.table('URL', url);
if (failure.type) {
cli.table('Type', failure.type);
}
if (failure.builtOn) {
cli.table('Built On', failure.builtOn);
}
if (!reason.includes('\n') && reason.length < 40) {
cli.table('Reason', chalk.red(reason));
} else {
cli.table('Reason', '');
const lines = reason.split('\n');
cli.log(` ${chalk.red(lines[0])}`);
for (let i = 1; i < lines.length; ++i) {
cli.log(` ${lines[i]}`);
}
}
displayFailure(cli, failure);

Check warning on line 295 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L295

Added line #L295 was not covered by tests
}

displayBuilds() {
Expand Down Expand Up @@ -917,6 +921,18 @@
}
}

class CommitV8Build extends NormalBuild {
constructor(cli, request, id) {
super(cli, request, 'node-test-commit-v8-linux', id);

Check warning on line 926 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L926

Added line #L926 was not covered by tests
}

display() {
for (const failure of this.failures) {
displayFailure(this.cli, failure);

Check warning on line 931 in lib/ci/ci_result_parser.js

View check run for this annotation

Codecov / codecov/patch

lib/ci/ci_result_parser.js#L930-L931

Added lines #L930 - L931 were not covered by tests
}
}
}

class TestRun extends Job {
constructor(cli, request, url) {
const path = getPath(url);
Expand Down Expand Up @@ -1022,6 +1038,7 @@
PRBuild,
BenchmarkRun,
CommitBuild,
CommitV8Build,
HealthBuild,
jobCache,
parseJobFromURL,
Expand Down