Skip to content

Commit aabcd35

Browse files
committed
[dev-utils/ci-stats] support disabling ship errors
1 parent 5a27e69 commit aabcd35

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

.ci/Jenkinsfile_security_cypress

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ kibanaPipeline(timeoutMinutes: 180) {
1010
) {
1111
catchError {
1212
withEnv([
13-
'CI_PARALLEL_PROCESS_NUMBER=1'
13+
'CI_PARALLEL_PROCESS_NUMBER=1',
14+
'IGNORE_SHIP_CI_STATS_ERROR=true'
1415
]) {
1516
def job = 'xpack-securityCypress'
1617

packages/kbn-dev-utils/src/ci_stats_reporter/ship_ci_stats_cli.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ export function shipCiStatsCli() {
2222
throw createFlagError('expected --metrics to be a string');
2323
}
2424

25+
const maybeFail = (message: string) => {
26+
const error = createFailError(message);
27+
if (process.env.IGNORE_SHIP_CI_STATS_ERROR === 'true') {
28+
error.exitCode = 0;
29+
}
30+
return error;
31+
};
32+
2533
const reporter = CiStatsReporter.fromEnv(log);
2634

2735
if (!reporter.isEnabled()) {
28-
throw createFailError('unable to initilize the CI Stats reporter');
36+
throw maybeFail('unable to initilize the CI Stats reporter');
2937
}
3038

3139
for (const path of metricPaths) {
@@ -35,7 +43,7 @@ export function shipCiStatsCli() {
3543
if (await reporter.metrics(JSON.parse(json))) {
3644
log.success('shipped metrics from', path);
3745
} else {
38-
throw createFailError('failed to ship metrics');
46+
throw maybeFail('failed to ship metrics');
3947
}
4048
}
4149
},

0 commit comments

Comments
 (0)