kibana/.buildkite/scripts/post_build_kibana.sh
Spencer 4e7560f19d
[ci-stats] move shipper to a package, validate limits in on-merge job (#149474)
We just had an issue where two PRs were merged and it caused the limit
of the `triggerActionsUi` bundle to be exceeded, breaking PR builds. The
issue is that we didn't see any indication of this in the on-merge jobs
because we don't produce the PR report for on-merge jobs or ask ci-stats
if we should fail the job. Instead, we just ship the metrics for
baseline purposes. This fixes that problem by adding a `--validate` flag
to `node scripts/ship_ci_stats`, which takes care of sending at least
some ci-stats and will verify that the bundle limits are not exceeded.

Since we didn't catch this issue in the on-merge job the limits were
incorrect for over an hour and merged into many PRs, wasting engineering
and CI time.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-25 08:20:40 -07:00

25 lines
757 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
if [[ ! "${DISABLE_CI_STATS_SHIPPING:-}" ]]; then
cmd=(
"node" "scripts/ship_ci_stats"
"--metrics" "target/optimizer_bundle_metrics.json"
"--metrics" "build/kibana/node_modules/@kbn/ui-shared-deps-src/shared_built_assets/metrics.json"
)
if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-on-merge" ]; then
cmd+=("--validate")
fi
echo "--- Ship Kibana Distribution Metrics to CI Stats"
"${cmd[@]}"
fi
echo "--- Upload Build Artifacts"
# Moving to `target/` first will keep `buildkite-agent` from including directories in the artifact name
cd "$KIBANA_DIR/target"
cp kibana-*-linux-x86_64.tar.gz kibana-default.tar.gz
buildkite-agent artifact upload "./*.tar.gz;./*.zip;./*.deb;./*.rpm"
cd -