@@ -29,8 +29,6 @@ const FAILURE = 'FAILURE';
2929const ABORTED = 'ABORTED' ;
3030const UNSTABLE = 'UNSTABLE' ;
3131
32- const SEP_LENGTH = 120 ;
33-
3432const TEST_PHASE = 'Binary Tests' ;
3533// com.tikal.jenkins.plugins.multijob.MultiJobBuild
3634const BUILD_FIELDS = 'builtOn,buildNumber,jobName,result,url' ;
@@ -247,7 +245,7 @@ class TestBuild extends Job {
247245
248246 displayHeader ( ) {
249247 const { cli, result, change } = this ;
250- cli . separator ( 'Summary' , SEP_LENGTH ) ;
248+ cli . separator ( 'Summary' ) ;
251249 cli . table ( 'Result' , resultName ( result ) ) ;
252250 cli . table ( 'URL' , this . jobUrl ) ;
253251 cli . table ( 'Source' , this . sourceURL ) ;
@@ -259,7 +257,7 @@ class TestBuild extends Job {
259257 displayFailure ( failure ) {
260258 const { cli } = this ;
261259 const { url, reason } = failure ;
262- cli . separator ( getNodeName ( url ) , SEP_LENGTH ) ;
260+ cli . separator ( getNodeName ( url ) ) ;
263261 cli . table ( 'URL' , url ) ;
264262 if ( failure . type ) {
265263 cli . table ( 'Type' , failure . type ) ;
@@ -284,7 +282,7 @@ class TestBuild extends Job {
284282 for ( const failure of failures ) {
285283 this . displayFailure ( failure ) ;
286284 }
287- cli . separator ( 'Other builds' , SEP_LENGTH ) ;
285+ cli . separator ( 'Other builds' ) ;
288286 for ( const aborted of builds . aborted ) {
289287 cli . table ( 'Aborted' , getUrl ( aborted . url ) ) ;
290288 }
@@ -336,7 +334,14 @@ function getHighlight(f) {
336334 . replace (
337335 / ' J N L P 4 - c o n n e c t c o n n e c t i o n f r o m .+ ?' / , 'JNLP4-connect connection from ...'
338336 )
339- . replace ( / F A T A L : C o u l d n o t c h e c k o u t \w + / , 'FATAL: Could not checkout ...' ) ;
337+ . replace ( / F A T A L : C o u l d n o t c h e c k o u t \w + / , 'FATAL: Could not checkout ...' )
338+ . replace (
339+ / e r r o r : p a t h s p e c .+ d i d n o t m a t c h a n y f i l e \( s \) k n o w n t o g i t / ,
340+ 'error: pathspec ... did not match any file(s) known to git' )
341+ . replace (
342+ / f a i l e d : n o w o r k s p a c e f o r .+ / ,
343+ 'failed: no workspace for ...'
344+ ) ;
340345}
341346
342347function markdownRow ( ...args ) {
@@ -347,6 +352,10 @@ function markdownRow(...args) {
347352 return result + '|\n' ;
348353}
349354
355+ function getMachineUrl ( name ) {
356+ return `[${ name } ](https://${ CI_DOMAIN } /computer/${ name } /)` ;
357+ }
358+
350359class FailureAggregator {
351360 constructor ( cli , failures ) {
352361 this . cli = cli ;
@@ -392,29 +401,48 @@ class FailureAggregator {
392401 aggregates = this . aggregates = this . aggregate ( ) ;
393402 }
394403
395- let output = '' ;
404+ const last = parseJobFromURL ( this . failures [ 0 ] . upstream ) ;
405+ const first = parseJobFromURL (
406+ this . failures [ this . failures . length - 1 ] . upstream
407+ ) ;
408+ const jobName = CI_TYPES . get ( first . type ) . jobName ;
409+ let output = 'Failures in ' ;
410+ output += `[${ jobName } /${ first . jobid } ](${ first . link } ) to ` ;
411+ output += `[${ jobName } /${ last . jobid } ](${ last . link } ) ` ;
412+ output += `that failed more than 2 PRs\n` ;
413+ const todo = [ ] ;
396414 for ( const type of Object . keys ( aggregates ) ) {
397415 output += `\n### ${ FAILURE_TYPES_NAME [ type ] } \n\n` ;
398416 for ( const item of aggregates [ type ] ) {
399417 const { reason, type, prs, failures, machines } = item ;
400418 if ( prs . length < 2 ) { continue ; }
401- output += markdownRow ( 'Reason' , `\`${ reason } \`` ) ;
419+ todo . push ( reason ) ;
420+ output += markdownRow ( 'Reason' , `<code>${ reason } </code>` ) ;
402421 output += markdownRow ( '-' , ':-' ) ;
403422 output += markdownRow ( 'Type' , type ) ;
404423 const source = prs . map ( f => f . source ) ;
405424 output += markdownRow (
406425 'Failed PR' , `${ source . length } (${ source . join ( ', ' ) } )`
407426 ) ;
408- output += markdownRow ( 'Appeared' , machines . join ( ', ' ) ) ;
427+ output += markdownRow (
428+ 'Appeared' , machines . map ( getMachineUrl ) . join ( ', ' )
429+ ) ;
409430 if ( prs . length > 1 ) {
410431 output += markdownRow ( 'First CI' , `${ prs [ 0 ] . upstream } ` ) ;
411432 }
412433 output += markdownRow ( 'Last CI' , `${ prs [ prs . length - 1 ] . upstream } ` ) ;
413- output += '\n' + fold ( 'Example' , failures [ 0 ] . reason ) + '\n' ;
414- output += '\n-------\n\n' ;
434+ output += '\n' ;
435+ output += fold (
436+ `<a href="${ failures [ 0 ] . url } ">Example</a>` ,
437+ failures [ 0 ] . reason
438+ ) ;
439+ output += '\n\n-------\n\n' ;
415440 }
416441 }
417- return output ;
442+
443+ output += '### Progress\n\n' ;
444+ output += todo . map ( i => `- \`${ i } \`` ) . join ( '\n' ) ;
445+ return output + '\n' ;
418446 }
419447
420448 display ( ) {
@@ -440,7 +468,7 @@ class FailureAggregator {
440468 cli . table ( 'First CI' , `${ prs [ 0 ] . upstream } ` ) ;
441469 }
442470 cli . table ( 'Last CI' , `${ prs [ prs . length - 1 ] . upstream } ` ) ;
443- cli . log ( '\n' + chalk . bold ( 'Example:' ) + '\n' ) ;
471+ cli . log ( '\n' + chalk . bold ( 'Example: ' ) + ` ${ failures [ 0 ] . url } \n` ) ;
444472 const example = failures [ 0 ] . reason ;
445473 cli . log ( example . length > 512 ? example . slice ( 0 , 512 ) + '...' : example ) ;
446474 cli . separator ( ) ;
@@ -802,7 +830,7 @@ class BenchmarkRun extends Job {
802830 display ( ) {
803831 const { cli, results, significantResults } = this ;
804832 cli . log ( results ) ;
805- cli . separator ( 'significant results' , SEP_LENGTH ) ;
833+ cli . separator ( 'significant results' ) ;
806834 cli . log ( significantResults ) ;
807835 }
808836
0 commit comments