Skip to content

Commit

Permalink
fix: link to failure console for "Appeared on" in ncu-ci
Browse files Browse the repository at this point in the history
Because it's more useful than the computer URL.
Also use CI URL for PRs instead of the PR URLs themselves.
  • Loading branch information
joyeecheung committed Oct 5, 2023
1 parent 77da02c commit 90674b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/ci/failure_aggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export class FailureAggregator {
.sortBy((f) => parseJobFromURL(f.upstream).jobid)
.map((item) => ({ source: item.source, upstream: item.upstream }))
.value();
const machines = _.uniq(failures.map(f => f.builtOn));
const machines = _.uniqBy(
failures.map(f => ({ hostname: f.builtOn, url: f.url })),
'hostname');
data.push({
reason, type: failures[0].type, failures, prs, machines
});
Expand Down Expand Up @@ -91,7 +93,7 @@ export class FailureAggregator {
output += markdownRow('Reason', `<code>${reason}</code>`);
output += markdownRow('-', ':-');
output += markdownRow('Type', type);
const source = prs.map(f => f.source);
const source = prs.map(f => `[${f.source}](${f.upstream})`);
output += markdownRow(
'Failed PR', `${source.length} (${source.join(', ')})`
);
Expand Down Expand Up @@ -137,7 +139,7 @@ export class FailureAggregator {
return parsed ? `#${parsed.prid}` : f.source;
});
cli.table('Failed PR', `${source.length} (${source.join(', ')})`);
cli.table('Appeared', machines.join(', '));
cli.table('Appeared', machines.map(m => m.hostname).join(', '));
if (prs.length > 1) {
cli.table('First CI', `${prs[0].upstream}`);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export function getPrURL({ owner, repo, prid }) {
return `https://github.com/${owner}/${repo}/pull/${prid}`;
};

export function getMachineUrl(name) {
return `[${name}](https://ci.nodejs.org/computer/${name}/)`;
export function getMachineUrl(machine) {
return `[${machine.hostname}](${machine.url})`;
};

const PR_URL_RE = /PR-URL: https:\/\/github.com\/.+/;
Expand Down

0 comments on commit 90674b5

Please sign in to comment.