Skip to content

Commit 5de5d9c

Browse files
committed
feat: enable parsing citgm-nobuild jobs
1 parent c1dfbd0 commit 5de5d9c

File tree

9 files changed

+635
-19
lines changed

9 files changed

+635
-19
lines changed

bin/ncu-ci

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

@@ -142,6 +146,10 @@ const argv = yargs
142146
default: false,
143147
describe: 'Write the results as markdown to clipboard'
144148
})
149+
.option('nobuild', {
150+
describe: 'If running cigtm, whether or not the CITGM job is citgm-nobuild',
151+
type: 'boolean'
152+
})
145153
.option('json <path>', {
146154
type: 'string',
147155
describe: 'Write the results as json to <path>'
@@ -209,7 +217,8 @@ class CICommand {
209217
build = new CommitBuild(cli, request, job.jobid);
210218
break;
211219
case CITGM:
212-
build = new CITGMBuild(cli, request, job.jobid);
220+
case CITGM_NOBUILD:
221+
build = new CITGMBuild(cli, request, job);
213222
break;
214223
case BENCHMARK:
215224
build = new BenchmarkRun(cli, request, job.jobid);
@@ -318,7 +327,8 @@ class JobCommand extends CICommand {
318327
async initialize() {
319328
this.queue.push({
320329
type: commandToType[this.command],
321-
jobid: this.argv.jobid
330+
jobid: this.argv.jobid,
331+
noBuild: this.argv.nobuild || false
322332
});
323333
}
324334
}

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
@@ -753,18 +753,21 @@ class PRBuild extends TestBuild {
753753
}
754754

755755
class CITGMBuild extends TestBuild {
756-
constructor(cli, request, id) {
757-
const path = `job/citgm-smoker/${id}/`;
756+
constructor(cli, request, job) {
757+
const { jobid, noBuild } = job;
758+
const path = noBuild
759+
? `job/citgm-smoker-nobuild/${jobid}/`
760+
: `job/citgm-smoker/${jobid}/`;
761+
758762
const tree = CITGM_MAIN_TREE;
759763

760764
super(cli, request, path, tree);
761765

762-
this.id = id;
766+
this.id = jobid;
767+
this.noBuild = noBuild;
763768
}
764769

765770
async getResults() {
766-
const { id } = this;
767-
768771
let headerData;
769772
try {
770773
headerData = await this.getBuildData('Summary');
@@ -782,7 +785,7 @@ class CITGMBuild extends TestBuild {
782785
// they do summary data, so we need to update the endpoint
783786
// and issue a second API call in order to fetch result data.
784787
this.tree = CITGM_REPORT_TREE;
785-
this.path = `job/citgm-smoker/${this.id}/testReport/`;
788+
this.updatePath(true);
786789

787790
let resultData;
788791
try {
@@ -797,7 +800,7 @@ class CITGMBuild extends TestBuild {
797800
this.results = this.parseResults(resultData);
798801

799802
// Update id again so that it correctly displays in Summary output.
800-
this.path = `job/citgm-smoker/${id}/`;
803+
this.updatePath(false);
801804

802805
return { result };
803806
}
@@ -826,6 +829,19 @@ class CITGMBuild extends TestBuild {
826829
return results;
827830
}
828831

832+
updatePath(testReport) {
833+
const { id, noBuild } = this;
834+
if (testReport) {
835+
this.path = noBuild
836+
? `job/citgm-smoker-nobuild/${id}/testReport/`
837+
: `job/citgm-smoker/${id}/testReport/`;
838+
} else {
839+
this.path = noBuild
840+
? `job/citgm-smoker-nobuild/${id}/`
841+
: `job/citgm-smoker/${id}/`;
842+
}
843+
}
844+
829845
displayBuilds() {
830846
const { cli, results } = this;
831847
const { failed, skipped, passed, total } = results.statistics;
@@ -887,7 +903,8 @@ class CITGMBuild extends TestBuild {
887903
output += `### [${failure}](${data.url})\n\n`;
888904

889905
const failures = data.modules.map(f => `* ${f.name}`);
890-
output += `${failures.join('\n')}\n\n`;
906+
const items = failures.length > 0 ? `${failures.join('\n')}` : 'None.';
907+
output += `${items}\n\n`;
891908
}
892909
return output;
893910
}

lib/ci/ci_type_parser.js

Lines changed: 18 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';
@@ -40,6 +41,12 @@ const CI_TYPES = new Map([
4041
pattern: /job\/citgm-smoker\/(\d+)/,
4142
type: JOB_CI
4243
}],
44+
[CITGM_NOBUILD, {
45+
name: 'CITGM',
46+
jobName: 'citgm-smoker-nobuild',
47+
pattern: /job\/citgm-smoker-nobuild\/(\d+)/,
48+
type: JOB_CI | LITE_CI
49+
}],
4350
[PR, {
4451
name: 'Full PR',
4552
jobName: 'node-test-pull-request',
@@ -211,8 +218,17 @@ module.exports = {
211218
CI_DOMAIN,
212219
CI_TYPES,
213220
CI_TYPES_KEYS: {
214-
CITGM, PR, COMMIT, BENCHMARK, LIBUV, V8, NOINTL,
215-
LINTER, LITE_PR, LITE_COMMIT
221+
CITGM,
222+
CITGM_NOBUILD,
223+
PR,
224+
COMMIT,
225+
BENCHMARK,
226+
LIBUV,
227+
V8,
228+
NOINTL,
229+
LINTER,
230+
LITE_PR,
231+
LITE_COMMIT
216232
},
217233
CI_PROVIDERS,
218234
isFullCI,

0 commit comments

Comments
 (0)