Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev-utils/ci-stats] support disabling ship errors #90851

Merged
merged 3 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .ci/Jenkinsfile_security_cypress
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ kibanaPipeline(timeoutMinutes: 180) {
) {
catchError {
withEnv([
'CI_PARALLEL_PROCESS_NUMBER=1'
'CI_PARALLEL_PROCESS_NUMBER=1',
'IGNORE_SHIP_CI_STATS_ERROR=true'
]) {
def job = 'xpack-securityCypress'

Expand Down
12 changes: 10 additions & 2 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 @@ -22,10 +22,18 @@ export function shipCiStatsCli() {
throw createFlagError('expected --metrics to be a string');
}

const maybeFail = (message: string) => {
const error = createFailError(message);
if (process.env.IGNORE_SHIP_CI_STATS_ERROR === 'true') {
error.exitCode = 0;
}
return error;
};

const reporter = CiStatsReporter.fromEnv(log);

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

for (const path of metricPaths) {
Expand All @@ -35,7 +43,7 @@ export function shipCiStatsCli() {
if (await reporter.metrics(JSON.parse(json))) {
log.success('shipped metrics from', path);
} else {
throw createFailError('failed to ship metrics');
throw maybeFail('failed to ship metrics');
}
}
},
Expand Down