Skip to content

Commit

Permalink
Add utility to list recent metal-ipi pass rates (#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
derekhiggins authored Nov 29, 2022
1 parent 5f597ad commit 915d147
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions scripts/periodics_pass_rates.sh
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

0 comments on commit 915d147

Please sign in to comment.