Skip to content

Commit b091609

Browse files
committed
feat: enable parsing citgm-nobuild jobs
1 parent f3d23dd commit b091609

File tree

9 files changed

+637
-19
lines changed

9 files changed

+637
-19
lines changed

bin/ncu-ci

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ const {
66
JobParser,
77
parseJobFromURL,
88
CI_TYPES_KEYS: {
9-
PR, COMMIT, BENCHMARK, CITGM, DAILY_MASTER
9+
PR,
10+
COMMIT,
11+
BENCHMARK,
12+
CITGM,
13+
CITGM_NOBUILD,
14+
DAILY_MASTER
1015
}
1116
} = require('../lib/ci/ci_type_parser');
1217

@@ -164,6 +169,10 @@ const argv = yargs
164169
default: false,
165170
describe: 'Write the results as markdown to clipboard'
166171
})
172+
.option('nobuild', {
173+
describe: 'If running cigtm, whether or not the CITGM job is citgm-nobuild',
174+
type: 'boolean'
175+
})
167176
.option('json <path>', {
168177
type: 'string',
169178
describe: 'Write the results as json to <path>'
@@ -231,7 +240,8 @@ class CICommand {
231240
build = new CommitBuild(cli, request, job.jobid);
232241
break;
233242
case CITGM:
234-
build = new CITGMBuild(cli, request, job.jobid);
243+
case CITGM_NOBUILD:
244+
build = new CITGMBuild(cli, request, job);
235245
break;
236246
case BENCHMARK:
237247
build = new BenchmarkRun(cli, request, job.jobid);
@@ -346,7 +356,8 @@ class JobCommand extends CICommand {
346356
async initialize() {
347357
this.queue.push({
348358
type: commandToType[this.command],
349-
jobid: this.argv.jobid
359+
jobid: this.argv.jobid,
360+
noBuild: this.argv.nobuild || false
350361
});
351362
}
352363
}

docs/ncu-ci.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ Commands:
2424
ncu-ci citgm <jobid> Show results of a citgm-smoker job
2525
2626
Options:
27-
--version Show version number [boolean]
28-
--copy Write the results as markdown to clipboard [default: false]
29-
--json Write the results as json to the path [string]
30-
--markdown Write the results as markdown to the path [string]
31-
--help Show help [boolean]
27+
--version Show version number [boolean]
28+
--copy Write the results as markdown to clipboard [default: false]
29+
--nobuild If running cigtm, whether or not the CITGM job is
30+
citgm-nobuild [boolean]
31+
--json <path> Write the results as json to <path> [string]
32+
--markdown <path> Write the results as markdown to <path> [string]
33+
--help Show help [boolean]
3234
```
3335

3436
### `ncu-ci rate <type>`

lib/ci/ci_result_parser.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,18 +767,21 @@ class PRBuild extends TestBuild {
767767
}
768768

769769
class CITGMBuild extends TestBuild {
770-
constructor(cli, request, id) {
771-
const path = `job/citgm-smoker/${id}/`;
770+
constructor(cli, request, job) {
771+
const { jobid, noBuild } = job;
772+
const path = noBuild
773+
? `job/citgm-smoker-nobuild/${jobid}/`
774+
: `job/citgm-smoker/${jobid}/`;
775+
772776
const tree = CITGM_MAIN_TREE;
773777

774778
super(cli, request, path, tree);
775779

776-
this.id = id;
780+
this.id = jobid;
781+
this.noBuild = noBuild;
777782
}
778783

779784
async getResults() {
780-
const { id } = this;
781-
782785
let headerData;
783786
try {
784787
headerData = await this.getBuildData('Summary');
@@ -796,7 +799,7 @@ class CITGMBuild extends TestBuild {
796799
// they do summary data, so we need to update the endpoint
797800
// and issue a second API call in order to fetch result data.
798801
this.tree = CITGM_REPORT_TREE;
799-
this.path = `job/citgm-smoker/${this.id}/testReport/`;
802+
this.updatePath(true);
800803

801804
let resultData;
802805
try {
@@ -811,7 +814,7 @@ class CITGMBuild extends TestBuild {
811814
this.results = this.parseResults(resultData);
812815

813816
// Update id again so that it correctly displays in Summary output.
814-
this.path = `job/citgm-smoker/${id}/`;
817+
this.updatePath(false);
815818

816819
return { result };
817820
}
@@ -840,6 +843,19 @@ class CITGMBuild extends TestBuild {
840843
return results;
841844
}
842845

846+
updatePath(testReport) {
847+
const { id, noBuild } = this;
848+
if (testReport) {
849+
this.path = noBuild
850+
? `job/citgm-smoker-nobuild/${id}/testReport/`
851+
: `job/citgm-smoker/${id}/testReport/`;
852+
} else {
853+
this.path = noBuild
854+
? `job/citgm-smoker-nobuild/${id}/`
855+
: `job/citgm-smoker/${id}/`;
856+
}
857+
}
858+
843859
displayBuilds() {
844860
const { cli, results } = this;
845861
const { failed, skipped, passed, total } = results.statistics;
@@ -901,7 +917,8 @@ class CITGMBuild extends TestBuild {
901917
output += `### [${failure}](${data.url})\n\n`;
902918

903919
const failures = data.modules.map(f => `* ${f.name}`);
904-
output += `${failures.join('\n')}\n\n`;
920+
const items = failures.length > 0 ? `${failures.join('\n')}` : 'None.';
921+
output += `${items}\n\n`;
905922
}
906923
return output;
907924
}

lib/ci/ci_type_parser.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const CI_DOMAIN = 'ci.nodejs.org';
99

1010
// constants
1111
const CITGM = 'CITGM';
12+
const CITGM_NOBUILD = 'CITGM_NOBUILD';
1213
const PR = 'PR';
1314
const COMMIT = 'COMMIT';
1415
const BENCHMARK = 'BENCHMARK';
@@ -41,6 +42,12 @@ const CI_TYPES = new Map([
4142
pattern: /job\/citgm-smoker\/(\d+)/,
4243
type: JOB_CI
4344
}],
45+
[CITGM_NOBUILD, {
46+
name: 'CITGM',
47+
jobName: 'citgm-smoker-nobuild',
48+
pattern: /job\/citgm-smoker-nobuild\/(\d+)/,
49+
type: JOB_CI | LITE_CI
50+
}],
4451
[PR, {
4552
name: 'Full PR',
4653
jobName: 'node-test-pull-request',
@@ -218,8 +225,18 @@ module.exports = {
218225
CI_DOMAIN,
219226
CI_TYPES,
220227
CI_TYPES_KEYS: {
221-
CITGM, PR, COMMIT, BENCHMARK, LIBUV, V8, NOINTL,
222-
LINTER, LITE_PR, LITE_COMMIT, DAILY_MASTER
228+
CITGM,
229+
CITGM_NOBUILD,
230+
PR,
231+
COMMIT,
232+
BENCHMARK,
233+
LIBUV,
234+
V8,
235+
NOINTL,
236+
LINTER,
237+
LITE_PR,
238+
LITE_COMMIT,
239+
DAILY_MASTER
223240
},
224241
CI_PROVIDERS,
225242
isFullCI,

0 commit comments

Comments
 (0)