summaryrefslogtreecommitdiffstats
path: root/jjb/global/installer-report.sh
blob: 6cd83f1f1cdfc826c95bf6dbd7d73a4cd17cd29b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

source $WORKSPACE/installer_track.sh

gen_content()
{
    cat <<EOF
{
    "installer": "$INSTALLER",
    "version": "$INSTALLER_VERSION",
    "pod_name": "$NODE_NAME",
    "job_name": "$JOB_NAME",
    "build_id": "$BUILD_ID",
    "scenario": "$DEPLOY_SCENARIO",
    "upstream_job_name": "$UPSTREAM_JOB_NAME",
    "upstream_build_id":"$UPSTREAM_BUILD_ID",
    "criteria": "$PROVISION_RESULT",
    "start_date": "$TIMESTAMP_START",
    "stop_date": "$TIMESTAMP_END",
    "details":""
}
EOF
}

echo "Installer: $INSTALLER provision result: $PROVISION_RESULT"
echo $(gen_content)

set -o xtrace
curl -H "Content-Type: application/json" -X POST -v -d "$(gen_content)" \
    $TESTAPI_URL/deployresults || true

# INFO
# postbuildscript plugin shall always return the original job running status,
# for the result returned from postbuildscript affects the CI pipeline.
if [ "$PROVISION_RESULT" == "PASS" ]; then
    exit 0
else
    exit 1
fi