Brian Freeman | 48d3054 | 2019-08-20 13:13:58 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | JOB=$1 |
| 4 | BUILD=$2 |
| 5 | |
| 6 | mkdir -p $JOB |
| 7 | JSON=$JOB/$BUILD.json |
| 8 | if [ ! -f $JSON ]; then |
| 9 | curl -s "http://localhost:8080/jenkins/job/$JOB/$BUILD/api/json" > $JSON |
| 10 | fi |
| 11 | |
| 12 | POD_TO_DELETE=$(jq -r '.actions[] | select(._class == "hudson.model.ParametersAction") | .parameters[] | select(._class == "hudson.model.StringParameterValue") | .value' < $JSON) |
| 13 | |
| 14 | TIMESTAMP=$(jq '.timestamp' < $JSON) |
| 15 | START_TIME=$(date -d @$(($TIMESTAMP/1000)) +%H:%M:%S) |
| 16 | |
| 17 | DURATION=$(jq '.duration' < $JSON) |
| 18 | DURATION_TIME=$(date -ud @$(($DURATION/1000)) +%M:%S) |
| 19 | |
| 20 | RESULT=$(jq -r '.result' < $JSON) |
| 21 | |
| 22 | echo "|$POD_TO_DELETE|$START_TIME|$DURATION_TIME|$RESULT|[$BUILD|http://onapci.org/logs/$JOB/$BUILD/]|" |