Skip to content

Commit

Permalink
[Ops] Trim long stat blocks (#171997)
Browse files Browse the repository at this point in the history
## Summary
Some post-build steps are failing because sometimes we're outgrowing the
buildkite metadata limits.

This PR will prevent upload of a text block too big, instead it will try
to gesture towards the build for more info.
  • Loading branch information
delanni committed Nov 27, 2023
1 parent c8537bf commit 750989b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .buildkite/pipeline-utils/ci-stats/on_complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ export async function onComplete() {

const report = await ciStats.getPrReport(process.env.CI_STATS_BUILD_ID);
if (report?.md) {
buildkite.setMetadata('pr_comment:ci_stats_report:body', report.md);
// buildkite has a metadata size limit of 100kb, so we only add this, if it's small enough
if (new Blob([report.md]).size < 100000) {
buildkite.setMetadata('pr_comment:ci_stats_report:body', report.md);
} else {
buildkite.setMetadata(
'pr_comment:ci_stats_report:body',
'The CI Stats report is too large to be displayed here, check out the CI build annotation for this information.'
);
}

const annotationType = report?.success ? 'info' : 'error';
buildkite.setAnnotation('ci-stats-report', annotationType, report.md);
Expand Down

0 comments on commit 750989b

Please sign in to comment.