File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
packages/kbn-dev-utils/src/ci_stats_reporter Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ export class CiStatsReporter {
109109 } ,
110110 } ) ;
111111
112- return ;
112+ return true ;
113113 } catch ( error ) {
114114 if ( ! error ?. request ) {
115115 // not an axios error, must be a usage error that we should notify user about
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import Path from 'path';
1010import Fs from 'fs' ;
1111
1212import { CiStatsReporter } from './ci_stats_reporter' ;
13- import { run , createFlagError } from '../run' ;
13+ import { run , createFlagError , createFailError } from '../run' ;
1414
1515export function shipCiStatsCli ( ) {
1616 run (
@@ -23,12 +23,20 @@ export function shipCiStatsCli() {
2323 }
2424
2525 const reporter = CiStatsReporter . fromEnv ( log ) ;
26+
27+ if ( ! reporter . isEnabled ( ) ) {
28+ throw createFailError ( 'unable to initilize the CI Stats reporter' ) ;
29+ }
30+
2631 for ( const path of metricPaths ) {
2732 // resolve path from CLI relative to CWD
2833 const abs = Path . resolve ( path ) ;
2934 const json = Fs . readFileSync ( abs , 'utf8' ) ;
30- await reporter . metrics ( JSON . parse ( json ) ) ;
31- log . success ( 'shipped metrics from' , path ) ;
35+ if ( await reporter . metrics ( JSON . parse ( json ) ) ) {
36+ log . success ( 'shipped metrics from' , path ) ;
37+ } else {
38+ throw createFailError ( 'failed to ship metrics' ) ;
39+ }
3240 }
3341 } ,
3442 {
You can’t perform that action at this time.
0 commit comments