aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/onap-lab-ci/jobs/get-result.sh
blob: 7ec39be2f66664fdc2dcca39478cb9b31d1e9086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

JOB=$1
BUILD=$2

mkdir -p $JOB
JSON=$JOB/$BUILD.json
if [ ! -f $JSON ]; then
    curl -s "http://localhost:8080/jenkins/job/$JOB/$BUILD/api/json" > $JSON
fi

POD_TO_DELETE=$(jq -r '.actions[] | select(._class == "hudson.model.ParametersAction") | .parameters[] | select(._class == "hudson.model.StringParameterValue") | .value' < $JSON)

TIMESTAMP=$(jq '.timestamp' < $JSON)
START_TIME=$(date -d @$(($TIMESTAMP/1000)) +%H:%M:%S)

DURATION=$(jq '.duration' < $JSON)
DURATION_TIME=$(date -ud @$(($DURATION/1000)) +%M:%S)

RESULT=$(jq -r '.result' < $JSON)

echo "|$POD_TO_DELETE|$START_TIME|$DURATION_TIME|$RESULT|[$BUILD|http://onapci.org/logs/$JOB/$BUILD/]|"