Created
July 17, 2023 00:16
-
-
Save drnic/09b04e299ec191454cb3ac34109322a7 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -euo pipefail | |
# e.g. https://api.buildkite.com/v2/organizations/myorg/pipelines/mypipeline/builds/1234 | |
build_url=${BUILD_URL} | |
function _curl() { | |
curl -sS -H "${BUILDKITE_API_AUTH?:required}" $@ | |
} | |
failed_jobs_raw_log_url=$( | |
_curl "${build_url}?include_retried_jobs=true" | | |
jq -r '.jobs | map(select(.exit_status != 0 and .type == "script")) | .[].raw_log_url' | |
) | |
for raw_log_url in ${failed_jobs_raw_log_url[@]}; do | |
log_data=$(_curl $raw_log_url) | |
echo "$log_data" | sed 's/\x1b\[[0-9;]*m//g' | grep -E '^rspec' | awk '{print $1 $2}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have retried jobs because some rspec commands are flakey. I wanted to find them.