-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CI_BUILD_START=$(date +%s) | ||
export CI_BUILD_START |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
post-checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,50 @@ | ||
#!/bin/bash -e | ||
|
||
[[ -n "$CARGO_TARGET_CACHE_NAME" ]] || exit 0 | ||
|
||
# | ||
# Save target/ for the next CI build on this machine | ||
# | ||
( | ||
d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME" | ||
mkdir -p $d | ||
set -x | ||
rsync -a --delete --link-dest=$PWD target $d | ||
du -hs $d | ||
) | ||
if [[ -n $CARGO_TARGET_CACHE_NAME ]]; then | ||
( | ||
d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME" | ||
mkdir -p "$d" | ||
set -x | ||
rsync -a --delete --link-dest="$PWD" target "$d" | ||
du -hs "$d" | ||
) | ||
fi | ||
|
||
# | ||
# Add job_stats data point | ||
# | ||
if [[ -z $CI_BUILD_START ]]; then | ||
echo Error: CI_BUILD_START empty | ||
else | ||
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 | ||
|
||
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" | ||
echo "Influx data point: $point" | ||
if [[ -n $INFLUX_USERNAME && -n $INFLUX_PASSWORD ]]; then | ||
echo "https://metrics.solana.com:8086/write?db=ci&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \ | ||
| xargs curl -XPOST --data-binary "$point" | ||
else | ||
echo Influx user credentials not found | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
post-command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pre-command |