Update return value from postbuildscript
[releng.git] / jjb / global / installer-report.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 source $WORKSPACE/installer_track.sh
11
12 gen_content()
13 {
14     cat <<EOF
15 {
16     "installer": "$INSTALLER",
17     "version": "$INSTALLER_VERSION",
18     "pod_name": "$NODE_NAME",
19     "job_name": "$JOB_NAME",
20     "build_id": "$BUILD_ID",
21     "scenario": "$DEPLOY_SCENARIO",
22     "upstream_job_name": "$UPSTREAM_JOB_NAME",
23     "upstream_build_id":"$UPSTREAM_BUILD_ID",
24     "criteria": "$PROVISION_RESULT",
25     "start_date": "$TIMESTAMP_START",
26     "stop_date": "$TIMESTAMP_END",
27     "details":""
28 }
29 EOF
30 }
31
32 echo "Installer: $INSTALLER provision result: $PROVISION_RESULT"
33 echo $(gen_content)
34
35 set -o xtrace
36 curl -H "Content-Type: application/json" -X POST -v -d "$(gen_content)" \
37     $TESTAPI_URL/deployresults || true
38
39 # INFO
40 # postbuildscript plugin shall always return the original job running status,
41 # for the result returned from postbuildscript affects the CI pipeline.
42 if [ "$PROVISION_RESULT" == "PASS" ]; then
43     exit 0
44 else
45     exit 1
46 fi