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