Add Jerma in blacklist logics
[releng.git] / utils / push-test-logs.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Orange and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -e
11 set -o pipefail
12
13 export PATH=$PATH:/usr/local/bin/
14
15 git_sha1="$(git rev-parse HEAD)"
16 res_build_date=${1:-$(date -u +"%Y-%m-%d_%H-%M-%S")}
17 project=$PROJECT
18 branch=${BRANCH##*/}
19 testbed=$NODE_NAME
20 dir_result="${HOME}/opnfv/$project/results/${branch}"
21 # src: https://wiki.opnfv.org/display/INF/Hardware+Infrastructure
22 # + intel-pod12 (vsperf)
23 node_list=(\
24 'lf-pod1' 'lf-pod2' \
25 'lf-virtual2' 'lf-virtual3' \
26 'intel-pod12' 'intel-pod18' \
27 'itri-pod1' \
28 'ericsson-pod1' 'ericsson-pod2' \
29 'ericsson-virtual1' 'ericsson-virtual2'  'ericsson-virtual3' \
30 'ericsson-virtual4' 'ericsson-virtual5' \
31 'arm-pod9' 'arm-pod10' \
32 'huawei-pod1' 'huawei-pod2' 'huawei-pod3' 'huawei-pod4' \
33 'huawei-pod6' 'huawei-pod7' 'huawei-pod12' 'huawei-pod8' \
34 'huawei-virtual1' 'huawei-virtual2' 'huawei-virtual3' 'huawei-virtual4' \
35 'huawei-virtual5' 'huawei-virtual8' 'huawei-virtual9' \
36 'zte-pod2' 'zte-pod3' 'zte-pod9' \
37 'zte-virtual1')
38
39
40 if [[ ! " ${node_list[@]} " =~ " ${testbed} " ]]; then
41     echo "This is not a CI POD. Aborting pushing the logs to artifacts."
42     exit 0
43 fi
44
45 if [[ "$branch" == "master" ]]; then
46     project_artifact=logs/$project/$testbed/$res_build_date
47 else
48     project_artifact=logs/$project/$testbed/$branch/$res_build_date
49 fi
50
51 # create the folder to store the results
52 mkdir -p $dir_result
53
54 # copy folder to artifact
55 if [ -d "$dir_result" ]; then
56     if [ "$(ls -A $dir_result)" ]; then
57         set +e
58         gsutil&>/dev/null
59         if [ $? != 0 ]; then
60             echo "Not possible to push results to artifact: gsutil not installed";
61         else
62             gsutil ls gs://artifacts.opnfv.org/"$project"/ &>/dev/null
63             if [ $? != 0 ]; then
64                 echo "Not possible to push results to artifact: some error happened when using gsutil";
65             else
66                 echo "Uploading logs to artifact $project_artifact"
67                 gsutil -m cp -r "$dir_result"/* gs://artifacts.opnfv.org/"$project_artifact"/ >/dev/null 2>&1
68                 echo "Logs can be found in https://artifacts.opnfv.org/logs_${project}_${testbed}.html"
69                 cd $dir_result
70                 files=($(find . -name \* -print|sed 's/^\.//'|sed '/^\s*$/d'))
71                 for f in ${files[@]}; do
72                     echo "https://artifacts.opnfv.org/${project_artifact}${f}"
73                 done
74             fi
75         fi
76     else
77           echo "Result folder is empty"
78     fi
79 fi