2018-06-30 21:51:15 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2023-03-16 06:17:29 -07:00
|
|
|
source ci/upload-ci-artifact.sh
|
|
|
|
|
2018-07-04 10:26:32 -07:00
|
|
|
#
|
|
|
|
# Add job_stats data point
|
|
|
|
#
|
|
|
|
if [[ -z $CI_BUILD_START ]]; then
|
|
|
|
echo Error: CI_BUILD_START empty
|
|
|
|
else
|
2023-03-16 06:17:29 -07:00
|
|
|
# make sure console outputs are uploaded as soon as possible, if any
|
|
|
|
(
|
|
|
|
shopt -s nullglob
|
|
|
|
for console_log in ./intercepted-console-*; do
|
|
|
|
gzip -f "$console_log"
|
|
|
|
upload-ci-artifact "$console_log.gz"
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2018-07-04 10:26:32 -07:00
|
|
|
CI_BUILD_DURATION=$(( $(date +%s) - CI_BUILD_START + 1 ))
|
|
|
|
|
|
|
|
CI_LABEL=${BUILDKITE_LABEL:-build label missing}
|
|
|
|
|
|
|
|
PR=false
|
|
|
|
if [[ $BUILDKITE_BRANCH =~ pull/* ]]; then
|
|
|
|
PR=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
SUCCESS=true
|
|
|
|
if [[ $BUILDKITE_COMMAND_EXIT_STATUS != 0 ]]; then
|
|
|
|
SUCCESS=false
|
|
|
|
fi
|
|
|
|
|
2022-09-06 20:39:06 -07:00
|
|
|
if [[ -n $BUILDKITE && -f "results.json" ]]; then
|
2023-04-05 03:25:36 -07:00
|
|
|
# extract lines which start with '{'
|
|
|
|
awk '/{.*/' results.json > sanitized-results.json
|
2022-08-15 22:20:29 -07:00
|
|
|
|
2023-03-30 02:02:37 -07:00
|
|
|
echo "~~~ Uploading test results to Buildkite Analytics"
|
|
|
|
buildkite-test-collector < sanitized-results.json
|
|
|
|
|
2023-04-05 03:25:36 -07:00
|
|
|
echo "~~~ Uploading test results to Datadog"
|
|
|
|
cargo2junit > results.xml < sanitized-results.json || true
|
|
|
|
if [[ -f "results.xml" ]]; then
|
|
|
|
datadog-ci junit upload --service solana results.xml
|
|
|
|
fi
|
2022-08-15 22:20:29 -07:00
|
|
|
fi
|
|
|
|
|
2018-07-04 10:26:32 -07:00
|
|
|
point_tags="pipeline=$BUILDKITE_PIPELINE_SLUG,job=$CI_LABEL,pr=$PR,success=$SUCCESS"
|
|
|
|
point_tags="${point_tags// /\\ }" # Escape spaces
|
|
|
|
|
|
|
|
point_fields="duration=$CI_BUILD_DURATION"
|
|
|
|
point_fields="${point_fields// /\\ }" # Escape spaces
|
|
|
|
|
|
|
|
point="job_stats,$point_tags $point_fields"
|
2018-07-21 23:15:36 -07:00
|
|
|
|
2018-08-27 22:41:58 -07:00
|
|
|
scripts/metrics-write-datapoint.sh "$point" || true
|
2018-07-04 10:26:32 -07:00
|
|
|
fi
|