github.com/noironetworks/cilium-net@v1.6.12/contrib/scripts/checkpr.sh (about) 1 #!/usr/bin/env bash 2 3 set -e 4 5 if ! which curl >/dev/null || ! which jq >/dev/null; then 6 echo "This tool requires 'curl' and 'jq' utilities to work correctly. Please install them." 7 exit 1 8 fi 9 10 if [ $# -eq 0 ] 11 then 12 echo "Usage: checkpr.sh PULL_REQUEST_ID" 13 exit 14 fi 15 16 PR_ID=$1 17 18 statuses=$(curl -s https://api.github.com/repos/cilium/cilium/pulls/${PR_ID} | jq -r '._links.statuses.href') 19 jenkins_urls=($(curl -s $statuses | jq -r '.[] | select(.target_url != null) | select(.target_url | contains("jenkins")) | .target_url' | sort | uniq)) 20 21 for base_url in "${jenkins_urls[@]}"; do 22 result="null" 23 first=true 24 until [ "$result" != "null" ]; do 25 if [ $first = true ]; then 26 first=false 27 else 28 sleep 60 29 fi 30 result=$(curl -s ${base_url}/api/json | jq ".result") 31 done 32 echo "PR $PR_ID result: $result" 33 echo "See $base_url for more details." 34 done 35 36 BARK_PATH="${BARK_PATH:-/usr/share/sounds/freedesktop/stereo/bell.oga}" 37 38 name=$(uname) 39 for run in {1..5} 40 do 41 if [ "$name" == "Linux" ]; then 42 paplay ${BARK_PATH} 43 else 44 # for osx 45 afplay /System/Library/Sounds/Ping.aiff 46 fi 47 done