-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utility to list recent metal-ipi pass rates (#1482)
- Loading branch information
1 parent
5f597ad
commit 915d147
Showing
1 changed file
with
50 additions
and
0 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,50 @@ | ||
#!/bin/bash | ||
# | ||
|
||
usage() { | ||
echo "$(basename $0) - list recent pass rates for metal-ipi jobs" 1>&2 | ||
echo "Usage: $(basename 0) [-h] [-l] RELEASE" 1>&2 | ||
echo " -l: list links to failed job runs" 1>&2 | ||
echo " RELEASE: release to display results for (default: all)" 1>&2 | ||
echo " eg: " 1>&2 | ||
echo " ./scripts/periodics_pass_rates.sh 4.13 | sort" 1>&2 | ||
echo " ./scripts/periodics_pass_rates.sh -l 4.13" 1>&2 | ||
exit 1 | ||
} | ||
|
||
LIST=0 | ||
while getopts ":l" o; do | ||
case "${o}" in | ||
l) | ||
LIST=1 | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
ALLJOBSURL="https://raw.githubusercontent.com/openshift/release/master/ci-operator/jobs/openshift/release/openshift-release-master-periodics.yaml" | ||
JOBSTOTEST=$(curl -s $ALLJOBSURL | yq -r ".periodics[] | select(.name | contains(\"metal-ipi\")) | select(.name | contains(\"${1:-periodic}-\")) | .name") | ||
|
||
function getJobSummary(){ | ||
JOB=$1 | ||
URL=https://prow.ci.openshift.org/job-history/gs/origin-ci-test/logs/$JOB | ||
DATA=$(curl --silent $URL | grep allBuilds - | grep -o '\[.*\]') | ||
SUCCESS=$(echo $DATA | jq '.[].Result' | grep "SUCCESS" | wc -l) | ||
TOTAL=$(echo $DATA | jq '.[].Result' | grep -v "PENDING" | wc -l) | ||
if [ "$TOTAL" == 0 ] ; then | ||
echo $JOB $SUCCESS/0 0% - ${URL} | ||
return | ||
fi | ||
echo $(( (SUCCESS * 100)/TOTAL ))% $SUCCESS/$TOTAL - ${URL} | ||
if [ "$LIST" == "1" ] ; then | ||
echo $DATA | jq '.[] | select(.Result | contains("FAILURE")) | " \(.Started) https://prow.ci.openshift.org/\(.SpyglassLink) " ' -r | ||
fi | ||
} | ||
|
||
for JOB in $JOBSTOTEST ; do | ||
getJobSummary $JOB | ||
done | ||
|