Skip to content
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

ncu-ci: add commit-v8 #390

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions bin/ncu-ci
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
Expand Up @@ -28,6 +28,7 @@ function pickContext(matches, text, {
}

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 BuildFailure extends CIResult {
}
}

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

// 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 @@ const FAILURE_FILTERS = [{
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
Expand Up @@ -63,6 +63,28 @@ function getPath(url) {
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);
}
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]}`);
}
}
}

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

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);
}

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

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

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

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