Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class CiStatsReporter {
},
});

return;
return true;
} catch (error) {
if (!error?.request) {
// not an axios error, must be a usage error that we should notify user about
Expand Down
14 changes: 11 additions & 3 deletions packages/kbn-dev-utils/src/ci_stats_reporter/ship_ci_stats_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';

import { CiStatsReporter } from './ci_stats_reporter';
import { run, createFlagError } from '../run';
import { run, createFlagError, createFailError } from '../run';

export function shipCiStatsCli() {
run(
Expand All @@ -23,12 +23,20 @@ export function shipCiStatsCli() {
}

const reporter = CiStatsReporter.fromEnv(log);

if (!reporter.isEnabled()) {
throw createFailError('unable to initilize the CI Stats reporter');
}

for (const path of metricPaths) {
// resolve path from CLI relative to CWD
const abs = Path.resolve(path);
const json = Fs.readFileSync(abs, 'utf8');
await reporter.metrics(JSON.parse(json));
log.success('shipped metrics from', path);
if (await reporter.metrics(JSON.parse(json))) {
log.success('shipped metrics from', path);
} else {
throw createFailError('failed to ship metrics');
}
}
},
{
Expand Down