diff options
Diffstat (limited to 'deployment/onap-lab-ci/jobs/get-result.sh')
-rwxr-xr-x | deployment/onap-lab-ci/jobs/get-result.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/deployment/onap-lab-ci/jobs/get-result.sh b/deployment/onap-lab-ci/jobs/get-result.sh new file mode 100755 index 000000000..7ec39be2f --- /dev/null +++ b/deployment/onap-lab-ci/jobs/get-result.sh @@ -0,0 +1,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/]|" |