Skip to content

Commit d4b189b

Browse files
authored
feat: enable parsing citgm-nobuild jobs (#458)
1 parent a77848e commit d4b189b

File tree

9 files changed

+632
-14
lines changed

9 files changed

+632
-14
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);
@@ -353,7 +363,8 @@ class JobCommand extends CICommand {
353363
async initialize() {
354364
this.queue.push({
355365
type: commandToType[this.command],
356-
jobid: this.argv.jobid
366+
jobid: this.argv.jobid,
367+
noBuild: this.argv.nobuild || false
357368
});
358369
}
359370
}

docs/ncu-ci.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Commands:
2727
Options:
2828
--version Show version number [boolean]
2929
--copy Write the results as markdown to clipboard [default: false]
30+
--nobuild If running cigtm, whether or not the CITGM job is
31+
citgm-nobuild [boolean]
3032
--json <path> Write the results as json to <path> [string]
3133
--markdown <path> Write the results as markdown to <path> [string]
3234
--help Show help [boolean]

lib/ci/ci_result_parser.js

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

762762
class CITGMBuild extends TestBuild {
763-
constructor(cli, request, id) {
764-
const path = `job/citgm-smoker/${id}/`;
763+
constructor(cli, request, job) {
764+
const { jobid, noBuild } = job;
765+
const path = noBuild
766+
? `job/citgm-smoker-nobuild/${jobid}/`
767+
: `job/citgm-smoker/${jobid}/`;
768+
765769
const tree = CITGM_MAIN_TREE;
766770

767771
super(cli, request, path, tree);
768772

769-
this.id = id;
773+
this.id = jobid;
774+
this.noBuild = noBuild;
770775
}
771776

772777
async getResults() {
773-
const { id } = this;
774-
775778
let headerData;
776779
try {
777780
headerData = await this.getBuildData('Summary');
@@ -789,7 +792,7 @@ class CITGMBuild extends TestBuild {
789792
// they do summary data, so we need to update the endpoint
790793
// and issue a second API call in order to fetch result data.
791794
this.tree = CITGM_REPORT_TREE;
792-
this.path = `job/citgm-smoker/${this.id}/testReport/`;
795+
this.updatePath(true);
793796

794797
let resultData;
795798
try {
@@ -804,7 +807,7 @@ class CITGMBuild extends TestBuild {
804807
this.results = this.parseResults(resultData);
805808

806809
// Update id again so that it correctly displays in Summary output.
807-
this.path = `job/citgm-smoker/${id}/`;
810+
this.updatePath(false);
808811

809812
return { result };
810813
}
@@ -833,6 +836,19 @@ class CITGMBuild extends TestBuild {
833836
return results;
834837
}
835838

839+
updatePath(testReport) {
840+
const { id, noBuild } = this;
841+
if (testReport) {
842+
this.path = noBuild
843+
? `job/citgm-smoker-nobuild/${id}/testReport/`
844+
: `job/citgm-smoker/${id}/testReport/`;
845+
} else {
846+
this.path = noBuild
847+
? `job/citgm-smoker-nobuild/${id}/`
848+
: `job/citgm-smoker/${id}/`;
849+
}
850+
}
851+
836852
displayBuilds() {
837853
const { cli, results } = this;
838854
const { failed, skipped, passed, total } = results.statistics;
@@ -894,7 +910,8 @@ class CITGMBuild extends TestBuild {
894910
output += `### [${failure}](${data.url})\n\n`;
895911

896912
const failures = data.modules.map(f => `* ${f.name}`);
897-
output += `${failures.join('\n')}\n\n`;
913+
const items = failures.length > 0 ? `${failures.join('\n')}` : 'None.';
914+
output += `${items}\n\n`;
898915
}
899916
return output;
900917
}

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)